Skip to content

Commit e8be966

Browse files
committed
Revert "preact iso"
This reverts commit 337a431.
1 parent 337a431 commit e8be966

File tree

5 files changed

+25
-94
lines changed

5 files changed

+25
-94
lines changed

demo/package-lock.json

Lines changed: 7 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"dependencies": {
1919
"@preact/preset-vite": "^2.5.0",
2020
"express": "^4.18.2",
21-
"preact": "^10.13.1",
22-
"preact-iso": "^2.3.0"
21+
"preact": "^10.12.1"
2322
}
2423
}

demo/src/App.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { h } from 'preact';
2-
import { lazy, Router, Route, ErrorBoundary } from 'preact-iso';
2+
import { Suspense, lazy } from 'preact/compat';
33

44
export function App({ head }) {
55
const Counter = lazy(
@@ -16,11 +16,9 @@ export function App({ head }) {
1616
<body>
1717
<main>
1818
<h1>Our Counter application</h1>
19-
<ErrorBoundary>
20-
<Router fallback={<p>Loading...</p>}>
21-
<Route component={Counter} path="/" />
22-
</Router>
23-
</ErrorBoundary>
19+
<Suspense fallback={<p>Loading...</p>}>
20+
<Counter />
21+
</Suspense>
2422
</main>
2523
{import.meta.env.DEV && (
2624
<script type="module" src="/src/entry-client.jsx" />

demo/src/entry-client.jsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { hydrate } from 'preact';
2-
import { LocationProvider } from 'preact-iso';
32
import { App } from './App';
43

54
const config = { attributes: true, childList: true, subtree: true };
@@ -17,9 +16,4 @@ const mut = new MutationObserver((mutationList, observer) => {
1716
});
1817
mut.observe(document, config);
1918

20-
hydrate(
21-
<LocationProvider>
22-
<App />
23-
</LocationProvider>,
24-
document
25-
);
19+
hydrate(<App />, document);

demo/src/entry-server.jsx

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
1-
import { LocationProvider } from 'preact-iso';
21
import { renderToPipeableStream } from '../../src/stream-node';
32
import { App } from './App';
43

5-
// @ts-ignore
6-
global.location = {
7-
origin: 'http://localhost:3000'
8-
};
9-
104
export function render({ res, head }) {
115
res.socket.on('error', (error) => {
126
console.error('Fatal', error);
137
});
14-
const { pipe, abort } = renderToPipeableStream(
15-
<LocationProvider url="/">
16-
<App head={head} />
17-
</LocationProvider>,
18-
{
19-
onShellReady() {
20-
res.statusCode = 200;
21-
res.setHeader('Content-type', 'text/html');
22-
pipe(res);
23-
},
24-
onErrorShell(error) {
25-
res.statusCode = 500;
26-
res.send(
27-
`<!doctype html><p>An error ocurred:</p><pre>${error.message}</pre>`
28-
);
29-
}
8+
const { pipe, abort } = renderToPipeableStream(<App head={head} />, {
9+
onShellReady() {
10+
res.statusCode = 200;
11+
res.setHeader('Content-type', 'text/html');
12+
pipe(res);
13+
},
14+
onErrorShell(error) {
15+
res.statusCode = 500;
16+
res.send(
17+
`<!doctype html><p>An error ocurred:</p><pre>${error.message}</pre>`
18+
);
3019
}
31-
);
20+
});
3221

3322
// Abandon and switch to client rendering if enough time passes.
3423
// Try lowering this to see the client recover.

0 commit comments

Comments
 (0)