Skip to content

Commit

Permalink
fix: skip nested markup containers
Browse files Browse the repository at this point in the history
  • Loading branch information
willtonkin committed Dec 11, 2018
1 parent 9d78582 commit efa6060
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/react-from-markup/src/rehydrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ export default async (
const roots = Array.from(
// TODO: allow setting a container identifier so multiple rehydration instances can exist
container.querySelectorAll("[data-react-from-markup-container]")
);
).reduce((acc: Element[], root: Element) => {
// filter roots that are contained within other roots
if (!acc.some(r => r.contains(root))) {
acc.push(root);
}
return acc;
}, []);

// TODO: solve race condition when a second rehydrate runs

Expand Down

0 comments on commit efa6060

Please sign in to comment.