Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/solid/src/server/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,15 @@ export function createUniqueId(): string {
}

export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element {
if (sharedConfig.context && !sharedConfig.context.noHydrate) {
if (sharedConfig.context) {
// Even under noHydrate we still need to isolate the id space for each
// component, so that `createResource` calls in sibling/nested components
// do not collide on the same context id when a parent `Suspense` resets
// `count` back to 0. Without this, a non-hydrating render of
// `<Post><Suspense><User/></Suspense></Post>` (each with a resource)
// produces two resources sharing the same id key in
// `context.resources` and the inner resource reads back the outer one's
// value. See #2546.
const c = sharedConfig.context;
setHydrateContext(nextHydrateContext());
const r = Comp(props || ({} as T));
Expand Down