Skip to content

Optimistic post and deleted posts#679

Merged
feruzm merged 3 commits into
developfrom
optimus
Feb 26, 2026
Merged

Optimistic post and deleted posts#679
feruzm merged 3 commits into
developfrom
optimus

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Feb 26, 2026

Summary by CodeRabbit

  • New Features
    • Show a pending/indexing view for missing or optimistic posts with background retrieval of the real post
    • Replace prior deleted-post path with a fallback that updates the UI when the post becomes available
    • Display progress indicators and a 30s timeout that triggers a slow-indexing message
    • Add localized messages for indexing states (en-US)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e34a868 and 4a281be.

📒 Files selected for processing (1)
  • apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-not-found-fallback.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-not-found-fallback.tsx

📝 Walkthrough

Walkthrough

New client-side UI handles missing entries: reads optimistic entry from the client cache, renders a pending/indexing view, polls a blockchain edge for the real post, updates the entry cache and triggers an SSR refresh on arrival, and switches to a timed-out warning after 30 seconds.

Changes

Cohort / File(s) Summary
Entry not-found & pending components
apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-not-found-fallback.tsx, apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-pending-index-view.tsx
Adds EntryNotFoundFallback (reads optimistic cache, detects optimistic placeholder, polls blockchain with separate query key, updates main cache via EcencyEntriesCacheManagement, triggers router.refresh, 30s timeout) and EntryPendingIndexView (renders indexing UI, author/meta, progress and timeout banner).
Component barrel & page change
apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/index.ts, apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/page.tsx
Re-exports new fallback component; replaces previous DeletedPostScreen usage with EntryNotFoundFallback in the entry page render path.
Localization
apps/web/src/features/i18n/locales/en-US.json
Adds i18n keys entry.indexing-blockchain and entry.indexing-slow for indexing status messages.

Sequence Diagram

sequenceDiagram
    participant Client as React Component (EntryNotFoundFallback)
    participant Cache as Client Cache
    participant Blockchain as Blockchain Edge
    participant Router as Next.js Router

    Client->>Cache: Read optimistic entry (on mount)
    alt Optimistic entry exists (post_id === 1)
        Client->>Client: mark isOptimistic, start 30s timeout
        Client->>Blockchain: Poll for real post (separate query key)
        Blockchain-->>Client: Poll response
        alt Real post received (post_id > 1)
            Client->>Cache: Update main entry cache (EcencyEntriesCacheManagement)
            Client->>Router: router.refresh()
        else No real post yet
            Client->>Client: Continue showing pending view or set isTimedOut after 30s
        end
    else No optimistic entry
        Client->>Client: Render DeletedPostScreen
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 From cache-soft hope to blockchain light,
I poll and wait through day and night.
Thirty seconds — tick, then bloom,
The entry lands to end the gloom.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title partially relates to the changeset. It mentions 'optimistic post' and 'deleted posts', which align with the optimistic entry caching and deleted post handling in the new EntryNotFoundFallback component, but is somewhat vague and lacks specificity about the primary change of introducing a new fallback component.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch optimus

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.

coderabbitai[bot]

This comment was marked as resolved.

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-not-found-fallback.tsx:
- Around line 34-39: Replace the ref-based transition gate with state: change
hasTransitioned from useRef(false) to useState(false), update handleSuccess (the
function named handleSuccess) to call setHasTransitioned(true) instead of
mutating hasTransitioned.current, and ensure the React Query option that checks
hasTransitioned for its enabled flag reads the state variable so setting it
immediately triggers a rerender and disables polling; also update the second
occurrence referenced around line 55 similarly.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1bf7648 and e34a868.

📒 Files selected for processing (1)
  • apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/_components/entry-not-found-fallback.tsx

@feruzm feruzm merged commit bbf3f68 into develop Feb 26, 2026
1 check passed
@feruzm feruzm deleted the optimus branch February 26, 2026 16:56
@coderabbitai coderabbitai Bot mentioned this pull request Mar 5, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Mar 30, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Apr 7, 2026
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