Skip to content

feat: optimize vercel fast origin trasnfer usages#506

Merged
antoncoding merged 1 commit into
masterfrom
feat/fast-origin-transfer-quotas
Apr 27, 2026
Merged

feat: optimize vercel fast origin trasnfer usages#506
antoncoding merged 1 commit into
masterfrom
feat/fast-origin-transfer-quotas

Conversation

@antoncoding
Copy link
Copy Markdown
Owner

@antoncoding antoncoding commented Apr 27, 2026

Summary by CodeRabbit

  • Performance
    • Optimized markets pages to use static generation, improving load times and reducing server-side rendering overhead. Search functionality now operates client-side from URL parameters, maintaining the same user experience with better performance characteristics.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monarch Ready Ready Preview, Comment Apr 27, 2026 5:35pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

📝 Walkthrough

Walkthrough

Changes three files to shift Markets component from server-side search param handling to client-side URL parsing. Adds dynamic = 'force-static' exports to page files and removes initialSearchParams prop passing, with the component now deriving state from window.location.search via useLayoutEffect.

Changes

Cohort / File(s) Summary
Static rendering configuration
app/market/[chainId]/[marketid]/page.tsx, app/markets/page.tsx
Added dynamic = 'force-static' export to force static generation. Markets page converted from async to sync function, removing searchParams prop and type definition.
Client-side search params
src/features/markets/markets-view.tsx
Removed initialSearchParams prop. Component now reads window.location.search directly via useLayoutEffect to populate state, with URL filter parsing moved to client side.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

feature request, ui

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to optimize 'vercel fast origin transfer usages' but the changes are about converting pages to static generation and moving search params to client-side. The title doesn't match the actual implementation. Update the title to reflect the actual changes, such as 'refactor: convert market pages to static generation with client-side search params' or similar.
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 (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/fast-origin-transfer-quotas

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 coderabbitai Bot added feature request Specific feature ready to be implemented ui User interface labels Apr 27, 2026
Copy link
Copy Markdown

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/features/markets/markets-view.tsx (1)

24-46: ⚠️ Potential issue | 🟡 Minor

One-shot read of window.location.search won't track URL changes.

The effect runs once on mount, so any later client-side navigation that mutates the URL (push/replace, back/forward) leaves currentSearchParams stale and urlFilterState won't re-apply. Also, the initial render parses an empty string before hydration, which can cause a brief filter flash.

If the URL is only ever set on hard load this is fine; otherwise consider a lazy initializer plus a popstate listener.

Possible tweak
-  const [currentSearchParams, setCurrentSearchParams] = useState('');
+  const [currentSearchParams, setCurrentSearchParams] = useState(() =>
+    typeof window === 'undefined'
+      ? ''
+      : window.location.search.replace(/^\?/, ''),
+  );
@@
-  useLayoutEffect(() => {
-    setCurrentSearchParams(window.location.search.startsWith('?') ? window.location.search.slice(1) : window.location.search);
-  }, []);
+  useLayoutEffect(() => {
+    const sync = () => setCurrentSearchParams(window.location.search.replace(/^\?/, ''));
+    sync();
+    window.addEventListener('popstate', sync);
+    return () => window.removeEventListener('popstate', sync);
+  }, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/features/markets/markets-view.tsx` around lines 24 - 46, The current
useLayoutEffect only reads window.location.search once, leaving
currentSearchParams stale on client-side navigation and causing an empty-string
parse before hydration; change the useState for currentSearchParams to a lazy
initializer that reads window.location.search when available (guard for SSR),
and replace the single-run useLayoutEffect with an effect that sets the initial
value and subscribes to history changes: add a 'popstate' listener that calls
setCurrentSearchParams(newSearch) and also patch or listen for
pushState/replaceState (or provide a small wrapper) so client-side navigations
update currentSearchParams; update references in urlFilterState (useMemo) will
then recompute correctly. Ensure you update the effect cleanup to remove
listeners; refer to currentSearchParams, setCurrentSearchParams, and the
existing useLayoutEffect for where to apply these changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/features/markets/markets-view.tsx`:
- Around line 24-46: The current useLayoutEffect only reads
window.location.search once, leaving currentSearchParams stale on client-side
navigation and causing an empty-string parse before hydration; change the
useState for currentSearchParams to a lazy initializer that reads
window.location.search when available (guard for SSR), and replace the
single-run useLayoutEffect with an effect that sets the initial value and
subscribes to history changes: add a 'popstate' listener that calls
setCurrentSearchParams(newSearch) and also patch or listen for
pushState/replaceState (or provide a small wrapper) so client-side navigations
update currentSearchParams; update references in urlFilterState (useMemo) will
then recompute correctly. Ensure you update the effect cleanup to remove
listeners; refer to currentSearchParams, setCurrentSearchParams, and the
existing useLayoutEffect for where to apply these changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: be0e72b3-83c4-42fd-b3ff-f3b920eed74b

📥 Commits

Reviewing files that changed from the base of the PR and between b29ea31 and cfec18e.

📒 Files selected for processing (3)
  • app/market/[chainId]/[marketid]/page.tsx
  • app/markets/page.tsx
  • src/features/markets/markets-view.tsx

@antoncoding antoncoding merged commit 15adaca into master Apr 27, 2026
4 checks passed
@antoncoding antoncoding deleted the feat/fast-origin-transfer-quotas branch April 27, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Specific feature ready to be implemented ui User interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant