Skip to content

fix(feed): prevent hydration mismatch from no-reblog filter - #1707

Open
sentry[bot] wants to merge 1 commit into
developfrom
seer/fix/feed-list-hydration
Open

fix(feed): prevent hydration mismatch from no-reblog filter#1707
sentry[bot] wants to merge 1 commit into
developfrom
seer/fix/feed-list-hydration

Conversation

@sentry

@sentry sentry Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: Cannot read properties of null (reading 'parentNode') that occurs during React hydration in the FeedList component.

Root Cause:
The FeedList component uses the no-reblog query parameter to filter entries. This filtering logic was applied immediately on the client-side via useMemo, while the server-side rendered HTML did not apply this filter (as useSearchParams returns null during SSR). This discrepancy led to a structural mismatch between the server-rendered DOM and the client's expected DOM, causing React to fail during hydration.

Solution:
The fix defers the application of the no-reblog filter until after the component has successfully hydrated on the client. A mounted state flag is introduced, initialized to false and set to true in a useEffect hook that runs only after the initial render. The useMemo hook that extracts and filters entries now only applies the no-reblog filter when mounted is true. This ensures that both the server and the initial client render produce the same unfiltered list, preventing the hydration mismatch and subsequent error.

Fixes ECENCY-NEXT-1FPX

This PR was automatically generated by Sentry. You can adjust this setting at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants