Skip to content

feat(changelogs): rolling 12-month window for updates stream#750

Merged
castrojo merged 1 commit into
projectbluefin:mainfrom
castrojo:fix/app-cards-collapsed-default
Apr 12, 2026
Merged

feat(changelogs): rolling 12-month window for updates stream#750
castrojo merged 1 commit into
projectbluefin:mainfrom
castrojo:fix/app-cards-collapsed-default

Conversation

@castrojo
Copy link
Copy Markdown
Contributor

OS release events and app release events older than 365 days are excluded from the Updates Stream. Pinned "Current Versions" cards are unaffected — they always show the latest release regardless of age.

OS release events and app release events older than 365 days are
excluded from the Updates Stream. Pinned "Current Versions" cards
are unaffected — they always show the latest release regardless of age.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@castrojo castrojo merged commit a29057e into projectbluefin:main Apr 12, 2026
1 check passed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a 12-month rolling window for the updates stream by filtering OS and app events. The review feedback identifies a hydration mismatch risk in the SSR/SSG environment caused by using Date.now() and recommends using a stable reference time from the metadata. Additionally, the reviewer notes that filtering the primary allEvents list may cause unintended side effects on global statistics and sidebar filters, suggesting the filter be applied specifically to the stream instead.

};

/** Rolling window for the Updates Stream — entries older than this are not shown. */
const ROLLING_WINDOW_MS = 365 * 24 * 60 * 60 * 1000;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using Date.now() for filtering logic in a React SSR/SSG environment like Docusaurus leads to hydration mismatches. The value of Date.now() during the server build will differ from the value when the client hydrates, potentially causing inconsistent rendering of the updates stream.

It is recommended to define a stable reference time at the module level, preferably derived from the data's own metadata (e.g., firehoseData.metadata.generatedAt), to ensure consistent results across server and client.

Suggested change
const ROLLING_WINDOW_MS = 365 * 24 * 60 * 60 * 1000;
const ROLLING_WINDOW_MS = 365 * 24 * 60 * 60 * 1000;
const STREAM_CUTOFF_MS = (firehoseData.metadata?.generatedAt ? new Date(firehoseData.metadata.generatedAt).getTime() : Date.now()) - ROLLING_WINDOW_MS;
References
  1. In React SSR environments, ensure consistent date and time values between server and client to avoid hydration mismatches.


// Rolling 12-month window for the stream — pinned cards (PINNED_OS_EVENTS) are unaffected.
const ALL_OS_STREAM_EVENTS: OsReleaseEvent[] = (() => {
const cutoff = Date.now() - ROLLING_WINDOW_MS;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Use the stable STREAM_CUTOFF_MS constant here to avoid hydration mismatches and ensure consistency with other filtered streams.

Suggested change
const cutoff = Date.now() - ROLLING_WINDOW_MS;
const cutoff = STREAM_CUTOFF_MS;
References
  1. In React SSR environments, ensure consistent date and time values between server and client to avoid hydration mismatches.

Comment on lines +533 to +536
const allEvents: FlatRelease[] = useMemo(() => {
const cutoff = Date.now() - ROLLING_WINDOW_MS;
return flattenReleases(firehoseData.apps ?? []).filter((e) => e.dateMs > cutoff);
}, []);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Filtering allEvents by date here has a significant side effect: it excludes older apps from the Statistics panel ("Total apps") and the Filters sidebar, even when no filters are active. This may be misleading if the user expects to see the total catalog size. If the intent was only to filter the "Updates Stream" feed, consider keeping allEvents as the full list and applying the date filter only when generating the unifiedStream.

Additionally, use the stable STREAM_CUTOFF_MS to prevent hydration mismatches.

  const allEvents: FlatRelease[] = useMemo(() => {
    return flattenReleases(firehoseData.apps ?? []).filter((e) => e.dateMs > STREAM_CUTOFF_MS);
  }, []);
References
  1. In React SSR environments, ensure consistent date and time values between server and client to avoid hydration mismatches.

@castrojo castrojo deleted the fix/app-cards-collapsed-default branch May 9, 2026 19:31
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.

1 participant