Skip to content

Commit

Permalink
Merge pull request #61 from preactjs/fix/use-id
Browse files Browse the repository at this point in the history
fix: `useId` past Preact 10.11.3
  • Loading branch information
rschristian authored Jul 14, 2024
2 parents 3eebb97 + 7ab2327 commit 5b435a1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"jest": "^26.0.0",
"lint-staged": "^11.0.1",
"microbundle": "^0.13.3",
"preact": "10.11.0",
"preact": "10.22.1",
"preact-render-to-string": "^5.2.4",
"prettier": "^2.0.5",
"rimraf": "3.0.2",
Expand Down
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import { assign, getChildren } from "./util";
import { options, Fragment, Component } from "preact";
import { options, Fragment, Component, h } from "preact";
import { Suspense } from "preact/compat";

const createContextDefaultValue = "__p";
Expand Down Expand Up @@ -42,6 +42,10 @@ export default function prepass(
children = [];
context = context || {};

if (!parent) {
parent = h(Fragment, null);
parent[_children] = parent[vnode];
}
vnode[_parent] = parent;

if (
Expand Down
4 changes: 2 additions & 2 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ describe("prepass", () => {
await prepass(<App />);

expect(ids).toEqual([
"P481",
"P15361",
"P0-0",
"P0-1",
])
})
})
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5603,10 +5603,10 @@ preact-render-to-string@^5.2.4:
dependencies:
pretty-format "^3.8.0"

preact@10.11.0:
version "10.11.0"
resolved "https://registry.yarnpkg.com/preact/-/preact-10.11.0.tgz#26af45a0613f4e17a197cc39d7a1ea23e09b2532"
integrity sha512-Fk6+vB2kb6mSJfDgODq0YDhMfl0HNtK5+Uc9QqECO4nlyPAQwCI+BKyWO//idA7ikV7o+0Fm6LQmNuQi1wXI1w==
preact@10.22.1:
version "10.22.1"
resolved "https://registry.yarnpkg.com/preact/-/preact-10.22.1.tgz#6a3589973fe0c6e53211091607d31f4b7b27334d"
integrity sha512-jRYbDDgMpIb5LHq3hkI0bbl+l/TQ9UnkdQ0ww+lp+4MMOdqaUYdFc5qeyP+IV8FAd/2Em7drVPeKdQxsiWCf/A==

prelude-ls@~1.1.2:
version "1.1.2"
Expand Down

0 comments on commit 5b435a1

Please sign in to comment.