Commit 0be4f2c
committed
fix(web): prevent history entries with mismatched URL/entity
When navigating between pages, the router updates location before the
old component unmounts. This caused the history tracking effect to
re-run with stale entityId/entityType props but a new URL, creating
corrupted entries like "Machine learning" pointing to /works/W123.
Changes:
- use-user-interactions: Validate URL matches entityType/entityId before
recording history entry (skip if URL doesn't contain entity path)
- catalogue-db: Filter out entries where stored entityType doesn't match
URL path in getHistory(), catching existing corrupted entries1 parent 45537d9 commit 0be4f2c
File tree
2 files changed
+34
-6
lines changed- apps/web/src/hooks
- packages/utils/src/storage
2 files changed
+34
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
248 | 262 | | |
249 | 263 | | |
250 | 264 | | |
| |||
254 | 268 | | |
255 | 269 | | |
256 | 270 | | |
257 | | - | |
258 | | - | |
259 | 271 | | |
260 | 272 | | |
261 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
1100 | 1103 | | |
1101 | 1104 | | |
1102 | 1105 | | |
| |||
1105 | 1108 | | |
1106 | 1109 | | |
1107 | 1110 | | |
1108 | | - | |
| 1111 | + | |
1109 | 1112 | | |
1110 | 1113 | | |
1111 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
1112 | 1130 | | |
1113 | 1131 | | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
| 1132 | + | |
1117 | 1133 | | |
1118 | 1134 | | |
1119 | 1135 | | |
| |||
0 commit comments