Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useId support #46

Closed
chrstntdd opened this issue Sep 17, 2022 · 1 comment · Fixed by #47
Closed

useId support #46

chrstntdd opened this issue Sep 17, 2022 · 1 comment · Fixed by #47

Comments

@chrstntdd
Copy link

The latest version of preact added a much appreciated useId hook.

When using preact-ssr-prepass, preact-render-to-string, and useId in a typical SSR setup as outlined in the docs, preact throws this error within the useId function.

TypeError: Cannot read properties of undefined (reading 'length')

Looking into the source, it seems that the mangled _mask property on the vnode (__v ?) is undefined.

function b() {
	var n = p(r++, 11);
	return (
		n.__ ||
			(n.__ =
				'P' +
				(function (n) {
                                          console.log({n, u: u.__v}); // n is undefined
					for (var t = 0, r = n.length; r > 0; )
						t = ((t << 5) - t + n.charCodeAt(--r)) | 0;
					return t;
				})(u.__v.o) +
				r),
		n.__
	);
}

Is this expected?


Dependencies:

"@preact/signals": "^1.0.4",
"preact": "^10.11.0",
"preact-render-to-string": "^5.2.4",
"preact-ssr-prepass": "^1.2.0"
@JoviDeCroock
Copy link
Member

JoviDeCroock commented Sep 17, 2022

We will probably need a similar PR to preactjs/preact-render-to-string#237 and calling options._diff 😅 will see what I can do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants