Skip to content

Commit

Permalink
fix: temporally suppress activity.id hydration mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
malangcat committed Jan 27, 2025
1 parent 19f57fc commit 3827bf5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/stackflow/src/primitive/AppScreen/useAppScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ export function useAppScreen(props: UseAppScreenProps) {
activity,
stateProps,
activityProps: elementProps({
id: activity?.id,
"data-part": "activity",
"data-activity-type": "full-screen",
...activityProps,
...stateProps,
"data-activity-id": activity?.id,
style: zIndexStyle,
// FIXME: @stackflow/react should prevent activity.id hydration mismatch; this is temporal fix.
suppressHydrationWarning: true,
}),
dimProps: elementProps({
"data-part": "dim",
Expand Down
6 changes: 1 addition & 5 deletions packages/stackflow/src/primitive/private/useTopActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ export function useTopActivity() {
useEffect(() => {
if (!topId) return;

const el = document.getElementById(topId);
if (!el) {
throw new Error(`Cannot find the top activity element with id: ${topId}`);
}

const el = document.querySelector<HTMLElement>(`[data-activity-id="${topId}"]`);
setTopEl(el);
}, [topId]);

Expand Down

0 comments on commit 3827bf5

Please sign in to comment.