Skip to content

Commit

Permalink
fix(productivity-suite): ensure the todos fragment has an id for crea…
Browse files Browse the repository at this point in the history
…tion/hydration

A previous commit (of mine) broke the rehydration of this fragment by stripping
the div that was used as the marker for the root of the component to rehydrate.
  • Loading branch information
petebacondarwin committed Oct 27, 2022
1 parent 9e943e3 commit 703bd1e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions productivity-suite/app/fragments/todos/src/worker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ export default {
env
).then((res) => res.text());

const [pre, post] = initialPageHtml.split(
'<div id="todos-fragment-root"></div>'
);
const appRootElement = '<div id="todos-fragment-root">';
const indexOfFragmentDiv = initialPageHtml.indexOf(appRootElement);
const indexForFragment = indexOfFragmentDiv + appRootElement.length;
const pre = initialPageHtml.slice(0, indexForFragment);
const post = initialPageHtml.slice(indexForFragment);
const stream = wrapStreamInText(
pre,
post,
Expand Down

0 comments on commit 703bd1e

Please sign in to comment.