Skip to content

Abort stuck queries - #744

Merged
feruzm merged 4 commits into
developfrom
abort
Apr 7, 2026
Merged

Abort stuck queries#744
feruzm merged 4 commits into
developfrom
abort

Conversation

@feruzm

@feruzmferuzm commented Apr 7, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Improved SSR timeout handling to cancel in-flight requests and avoid hangs.
    • Wrapped error-reporting initialization to prevent startup crashes when telemetry fails.
  • Performance

    • Parallelized several background data fetches for faster load.
    • Added post-image preload on entry pages to improve LCP.
  • New Features

    • Query/request cancellation support added across fetchers to enable aborting stuck calls.
  • Chores

    • Updated dependency versions and package metadata.
  • Tests

    • Updated unit tests to expect added cancellation argument.

@coderabbitai

coderabbitaiBot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f6b30f4-898a-48f6-acf8-c6fbca1fdcf5

📥 Commits

Reviewing files that changed from the base of the PR and between 8b1d5f2 and f62a7a5.

⛔ Files ignored due to path filters (7)
  • packages/sdk/dist/browser/index.d.ts is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (4)
  • packages/sdk/CHANGELOG.md
  • packages/sdk/package.json
  • packages/wallets/CHANGELOG.md
  • packages/wallets/package.json
✅ Files skipped from review due to trivial changes (4)
  • packages/wallets/package.json
  • packages/sdk/CHANGELOG.md
  • packages/wallets/CHANGELOG.md
  • packages/sdk/package.json

📝 Walkthrough

Walkthrough

Propagated AbortSignal through SDK RPC/bridge calls and React Query queryFns; added SSR timeout cancellation that aborts in-flight queries via React Query client; bumped @ecency/hive-tx to ^7.3.2; added Next.js optimizePackageImports and wrapped Sentry init in try/catch; added LCP image preload.

Changes

Cohort / File(s)Summary
Dependency updates
apps/web/package.json, packages/sdk/package.json
Bumped @ecency/hive-tx constraint to ^7.3.2; SDK package version -> 2.1.3.
React Query SSR helpers
apps/web/src/core/react-query/query-helpers.ts
withSsrTimeout accepts optional queryKey, uses explicit timer, and cancels in-flight queries via getQueryClient().cancelQueries({ queryKey }) on timeout; prefetch/fetch helpers forward options.queryKey.
SDK — AbortSignal plumbing (bridge, posts, accounts, core)
packages/sdk/src/modules/bridge/requests.ts, packages/sdk/src/modules/posts/queries/..., packages/sdk/src/modules/accounts/queries/get-account-full-query-options.ts, packages/sdk/src/modules/core/queries/get-dynamic-props-query-options.ts
Added optional signal?: AbortSignal to public/internal functions and forwarded it into callRPC/bridgeApiCall; queryFns now accept React Query { signal } and pass it to SDK calls; dynamic props RPCs run in parallel via Promise.all.
Tests adjusted for signal arg
packages/sdk/src/modules/posts/queries/get-account-posts-query-options.spec.ts, packages/sdk/src/modules/posts/queries/get-posts-ranked-query-options.spec.ts
Updated mock expectations to include the new trailing signal argument (e.g., expect.any(Object) or undefined).
Next.js & Sentry changes
apps/web/next.config.js, apps/web/sentry.client.config.ts
Added experimental.optimizePackageImports allowlist; wrapped Sentry init/setTag in try/catch and gated capture of buffered early errors on successful init.
Entry page LCP preload
apps/web/src/app/(dynamicPages)/entry/[category]/[author]/[permlink]/page.tsx
Computed lcpImage via catchPostImage(...) and conditionally preloaded it with <link rel="preload" as="image" fetchPriority="high" /> during SSR.
Changelogs & package bumps
packages/sdk/CHANGELOG.md, packages/wallets/CHANGELOG.md, packages/wallets/package.json
Added 2.1.3 changelog entry ("Abort stuck queries"); bumped wallets to 3.0.3 referencing SDK 2.1.3.

Sequence Diagram(s)

sequenceDiagram
participant Client
participant ReactQuery as React Query helpers
participant SDK
participant RPC as RPC/Bridge
Client->>ReactQuery: prefetch/fetch request
ReactQuery->>ReactQuery: withSsrTimeout(start timer, retain queryKey)
ReactQuery->>SDK: invoke queryFn (passes { signal }, options.queryKey)
SDK->>RPC: callRPC(..., signal)
alt RPC responds before timeout
RPC-->>SDK: data
SDK-->>ReactQuery: resolve data
ReactQuery-->>Client: return data (clear timer)
else SSR timeout fires
ReactQuery->>ReactQuery: timer fires
ReactQuery->>ReactQuery: getQueryClient().cancelQueries({ queryKey })
ReactQuery-->>Client: resolve undefined (timeout)
ReactQuery->>SDK: signal aborted -> RPC aborts
end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇
Signals whisper, timers lightly tap,
Queries gently halted mid‑hop and nap,
Images primed to sprint the first-frame race,
Abort and tidy — swift, clean interface,
— Hops & cheers from your Rabbit Dev 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring 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 nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe pull request title 'Abort stuck queries' directly and clearly summarizes the main objective of the changeset, which adds abort signal support throughout the codebase to enable cancellation of in-flight React Query requests.

✏️ 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 abort

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.

coderabbitai[bot]

This comment was marked as resolved.

@feruzmferuzm added the patch Bug fixes and patches (1.0.0 → 1.0.1) label Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patchBug fixes and patches (1.0.0 → 1.0.1)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@feruzm