Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0b48b62
fix(plugin-history-sync): prevent SSR hydration mismatch with non-emp…
ENvironmentSet May 31, 2026
c554889
Merge branch 'main' into feature/fep-2349
ENvironmentSet May 31, 2026
c1e8780
test(plugin-history-sync): harden defaultHistory SSR/setup test defin…
ENvironmentSet Jun 1, 2026
13b9b45
test(plugin-history-sync): simplify SSR regression comment
ENvironmentSet Jun 1, 2026
6269389
test(plugin-history-sync): use deterministic SSR event dates
ENvironmentSet Jun 1, 2026
e97c2ad
test(plugin-history-sync): use react stackflow in SSR spec
ENvironmentSet Jun 1, 2026
1b4964e
test(plugin-history-sync): avoid render-side stack probe
ENvironmentSet Jun 1, 2026
0cfea55
test(plugin-history-sync): render defaultHistory setup tests
ENvironmentSet Jun 1, 2026
4f0c061
test(plugin-history-sync): inline history location assertion
ENvironmentSet Jun 1, 2026
345fe28
test(plugin-history-sync): reuse makeApp for react setup tests
ENvironmentSet Jun 1, 2026
7b53166
test(plugin-history-sync): remove defaultHistory setup comment
ENvironmentSet Jun 1, 2026
b9e00a0
test(plugin-history-sync): inspect activity snapshots
ENvironmentSet Jun 1, 2026
90c18e7
test(plugin-history-sync): refactor react setup specs
ENvironmentSet Jun 1, 2026
40d5567
test(plugin-history-sync): drop incidental articleId from T-O-5 home …
ENvironmentSet Jun 1, 2026
845512f
fix(plugin-history-sync): widen @stackflow/* peer deps to support sta…
ENvironmentSet Jun 1, 2026
d954266
chore(plugin-history-sync): sync yarn.lock with widened peer deps
ENvironmentSet Jun 1, 2026
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
9 changes: 9 additions & 0 deletions .changeset/fix-ssr-hydration-default-history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@stackflow/plugin-history-sync": patch
---

Fix an SSR hydration mismatch that occurred when an activity declared a non-empty `defaultHistory`.

The staged `defaultHistory` setup navigation was kicked off synchronously inside the `onInit` hook, which runs during the first client render. As a result, the client's first render contained more activities than the server-rendered output, producing a React hydration mismatch.

The setup navigation is now kicked off from a post-commit effect instead, so the server and the client's first render produce identical output (eliminating the mismatch) while the staged "stacking" setup animation still plays after hydration.
60 changes: 47 additions & 13 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions extensions/plugin-history-sync/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { TextDecoder, TextEncoder } = require("node:util");

// `jest-environment-jsdom` does not expose `TextEncoder`/`TextDecoder`, which
// `react-dom/server` requires. Polyfill them for the SSR/hydration tests.
if (typeof globalThis.TextEncoder === "undefined") {
globalThis.TextEncoder = TextEncoder;
}
if (typeof globalThis.TextDecoder === "undefined") {
globalThis.TextDecoder = TextDecoder;
}
28 changes: 24 additions & 4 deletions extensions/plugin-history-sync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,22 @@
"index.ts",
"index.tsx"
],
"setupFiles": [
"<rootDir>/jest.setup.js"
],
"transform": {
"^.+\\.(t|j)sx?$": "@swc/jest"
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
"jsc": {
"transform": {
"react": {
"runtime": "automatic"
}
}
}
}
]
}
},
"dependencies": {
Expand All @@ -51,28 +65,34 @@
"@stackflow/config": "^2.0.0",
"@stackflow/core": "^2.0.0",
"@stackflow/esbuild-config": "^1.0.3",
"@stackflow/plugin-renderer-basic": "^1.1.14",
"@stackflow/react": "^2.0.0",
"@swc/core": "^1.6.6",
"@swc/jest": "^0.2.36",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.3.2",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-relay": "^16.0.6",
"@types/relay-runtime": "^17",
"esbuild": "^0.23.0",
"graphql": "^16.9.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-relay": "^17.0.0",
"relay-compiler": "^17.0.0",
"relay-runtime": "^17.0.0",
"rimraf": "^3.0.2",
"typescript": "^5.5.3"
},
"peerDependencies": {
"@stackflow/config": "^2.0.0",
"@stackflow/core": "^2.0.0",
"@stackflow/react": "^2.0.0",
"@stackflow/config": "^1.1.0 || ^2.0.0",
"@stackflow/core": "^1.0.0 || ^2.0.0",
"@stackflow/react": "^1.0.0 || ^2.0.0",
"@types/react": ">=16.8.0",
"react": ">=16.8.0"
},
Expand Down
Loading
Loading