Skip to content

Staleness and parallel fix#749

Merged
feruzm merged 2 commits into
developfrom
imp
Apr 9, 2026
Merged

Staleness and parallel fix#749
feruzm merged 2 commits into
developfrom
imp

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Apr 9, 2026

Summary by CodeRabbit

  • Performance Improvements

    • Community posts and entry pages now prefetch related data in parallel for faster page load.
    • Chat unread count refresh delay increased to reduce unnecessary background updates.
  • Bug Fixes

    • Discussions now show a loading skeleton and a clear error panel with a retry button when comments fail to load.
  • Localization

    • Added a user-facing message for comment load failures: “Failed to load comments. Tap to retry”.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 9, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b7caf0a5-7811-4d20-9e4a-03a937b1b3ca

📥 Commits

Reviewing files that changed from the base of the PR and between babc6d7 and 7db2368.

📒 Files selected for processing (1)
  • apps/web/src/features/i18n/locales/en-US.json

📝 Walkthrough

Walkthrough

Parallelized prefetches for community and entry pages, replaced a Suspense-based discussions query with explicit useQuery state handling, increased Mattermost unread query staleTime, and added an i18n string for discussion load errors.

Changes

Cohort / File(s) Summary
Community posts prefetch
apps/web/src/app/(dynamicPages)/community/[community]/[tag]/page.tsx
Prefetches community cache and posts feed concurrently via Promise.all; retains notFound()/null guards and same rendering of data.pages.flatMap(pageToEntries).
Entry page prefetch
apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/page.tsx
Runs entry-by-path fetch and account-cache warm in parallel using Promise.all; warms account cache using URL author instead of waiting for entry.author.
Discussions loader state handling
apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-page-discussions-wrapper.tsx
Replaced useSuspenseQuery+Suspense with useQuery and explicit render-time handling; shows DiscussionsSkeleton while loading and an error panel with retry on failure.
Mattermost cache config
apps/web/src/features/chat/mattermost-api.ts
Increased staleTime for ["mattermost-unread", username] from 30000 ms to 60000 ms.
i18n
apps/web/src/features/i18n/locales/en-US.json
Added discussion.load-error message: "Failed to load comments. Tap to retry".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Staleness and parallel fix #749: Same set of edits (parallel prefetches, discussions query change, mattermost staleTime, i18n addition).
  • DM warning #630: Also modifies useMattermostUnread in apps/web/src/features/chat/mattermost-api.ts with related changes.
  • Chats improvements #629: Adjusts useMattermostUnread staleTime (30000→60000), matching this change.

Poem

🐰 Hop-hop, I warmed the cache in two,

Fetches race, no queues in view,
Skeleton waits, errors can retry,
Unread counts nap a little longer—shh, don’t pry,
I nibble bytes and watch the UI fly.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title partially relates to the changeset by referencing 'staleness' and 'parallel' fixes, which correspond to actual changes (staleTime adjustment and parallel prefetching), but lacks clarity about the specific scope and doesn't clearly convey the main changes to a scanning developer. Consider a more descriptive title like 'Optimize data prefetching with parallel queries and adjust cache staleness' to clearly communicate the primary changes across affected files.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch imp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/web/src/app/`(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-page-discussions-wrapper.tsx:
- Line 31: The i18next call using the translation key "discussion.load-error" is
missing from the English locale, so add "load-error": "Failed to load comments.
Tap to retry" into the discussion object in the en-US.json locales file so the
i18next.t("discussion.load-error", { defaultValue: ... }) call has a real entry;
update the discussion object in en-US.json to include that key and string.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 80c25f5f-3961-4ba0-8d30-c767e8600b9a

📥 Commits

Reviewing files that changed from the base of the PR and between c775c8e and babc6d7.

📒 Files selected for processing (4)
  • apps/web/src/app/(dynamicPages)/community/[community]/[tag]/page.tsx
  • apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-page-discussions-wrapper.tsx
  • apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/page.tsx
  • apps/web/src/features/chat/mattermost-api.ts

@feruzm feruzm merged commit b2ef474 into develop Apr 9, 2026
1 check was pending
@feruzm feruzm deleted the imp branch April 9, 2026 12:00
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