fix: browser not reloaded when no island present (#1956)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"lock": false,
|
||||
"imports": {
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.15.1",
|
||||
"preact/": "https://esm.sh/preact@10.15.1/",
|
||||
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1",
|
||||
"@preact/signals": "https://esm.sh/*@preact/signals@1.1.5",
|
||||
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.3.1"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact"
|
||||
}
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env -S deno run -A --watch=static/,routes/
|
||||
|
||||
import dev from "$fresh/dev.ts";
|
||||
|
||||
await dev(import.meta.url, "./main.ts");
|
||||
@@ -0,0 +1,22 @@
|
||||
// DO NOT EDIT. This file is generated by Fresh.
|
||||
// This file SHOULD be checked into source version control.
|
||||
// This file is automatically updated during development when running `dev.ts`.
|
||||
|
||||
import * as $0 from "./routes/index.tsx";
|
||||
import * as $1 from "./routes/island.tsx";
|
||||
import * as $2 from "./routes/no_island.tsx";
|
||||
import * as $$0 from "./islands/Counter.tsx";
|
||||
|
||||
const manifest = {
|
||||
routes: {
|
||||
"./routes/index.tsx": $0,
|
||||
"./routes/island.tsx": $1,
|
||||
"./routes/no_island.tsx": $2,
|
||||
},
|
||||
islands: {
|
||||
"./islands/Counter.tsx": $$0,
|
||||
},
|
||||
baseUrl: import.meta.url,
|
||||
};
|
||||
|
||||
export default manifest;
|
||||
@@ -0,0 +1,12 @@
|
||||
import { useSignal } from "@preact/signals";
|
||||
|
||||
export default function Counter() {
|
||||
const sig = useSignal(0);
|
||||
|
||||
return (
|
||||
<div class="counter">
|
||||
<p>{sig}</p>
|
||||
<button onClick={() => sig.value++}>update</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
/// <reference lib="dom.asynciterable" />
|
||||
/// <reference lib="deno.ns" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
|
||||
await start(manifest);
|
||||
@@ -0,0 +1,27 @@
|
||||
import * as path from "https://deno.land/std@0.192.0/path/mod.ts";
|
||||
|
||||
const __dirname = path.dirname(path.fromFileUrl(import.meta.url));
|
||||
|
||||
const links: string[] = [];
|
||||
for (const file of Deno.readDirSync(__dirname)) {
|
||||
if (file.name.startsWith("index")) continue;
|
||||
const name = path.basename(file.name, path.extname(file.name));
|
||||
links.push(name);
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div>
|
||||
<h1>Tests</h1>
|
||||
<ul>
|
||||
{links.sort().map((link) => {
|
||||
return (
|
||||
<li key={link}>
|
||||
<a href={`/${link}`}>{link}</a>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div class="foo">
|
||||
<h1>foo</h1>
|
||||
<Counter />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default function Home() {
|
||||
return <h1 class="foo">foo</h1>;
|
||||
}
|
||||
Reference in New Issue
Block a user