Skip to content

[FE-2371] chore(studio): swap useMemo for useLayoutEffect in useRegisterPage#42308

Merged
alaister merged 1 commit intomasterfrom
chore/useRegisterPage-swap-useMemo-for-useLayoutEffect
Jan 31, 2026
Merged

[FE-2371] chore(studio): swap useMemo for useLayoutEffect in useRegisterPage#42308
alaister merged 1 commit intomasterfrom
chore/useRegisterPage-swap-useMemo-for-useLayoutEffect

Conversation

@alaister
Copy link
Member

@alaister alaister commented Jan 30, 2026

This is largely to avoid setting state inside a useMemo().

Summary by CodeRabbit

  • Refactor
    • Optimized CommandMenu page registration timing and dependency handling to improve synchronization with DOM updates.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 30, 2026

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

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Jan 30, 2026 6:07am
docs Ready Ready Preview, Comment Jan 30, 2026 6:07am
studio-self-hosted Ready Ready Preview, Comment Jan 30, 2026 6:07am
studio-staging Ready Ready Preview, Comment Jan 30, 2026 6:07am
ui-library Ready Ready Preview, Comment Jan 30, 2026 6:07am
zone-www-dot-com Ready Ready Preview, Comment Jan 30, 2026 6:07am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
cms Ignored Ignored Jan 30, 2026 6:07am
studio Ignored Ignored Jan 30, 2026 6:07am

Request Review

@supabase
Copy link

supabase bot commented Jan 30, 2026

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 30, 2026

Walkthrough

The page registration hook is refactored to use useLayoutEffect instead of useEffect for synchronous DOM registration timing. Dependency tracking changes from equality checks to useLatest hook. The public API exports are reordered without adding or removing any functions.

Changes

Cohort / File(s) Summary
Page Registration Hook Refactoring
packages/ui-patterns/src/CommandMenu/api/hooks/pagesHooks.ts
Updated useRegisterPage hook to use useLayoutEffect and useLatest for improved registration timing; replaced lodash equality checks and memoization with direct dependency access; reordered public API exports in arbitrary order without functional changes.
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely missing. The required template sections (CONTRIBUTING.md confirmation, change type, current behavior, new behavior, and additional context) are not provided. Add a complete pull request description following the template, including confirmation of reading CONTRIBUTING.md, the change type (chore), relevant issue links, and explanation of the refactoring rationale.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing useMemo with useLayoutEffect in the useRegisterPage hook, which aligns with the code modifications shown in the summary.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/useRegisterPage-swap-useMemo-for-useLayoutEffect

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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
Contributor

@charislam charislam left a comment

Choose a reason for hiding this comment

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

surprised that stupid hack took two years to come back and bite me 😢 thanks so much for the debugging on this ❤️

@alaister alaister merged commit 53d345d into master Jan 31, 2026
25 checks passed
@alaister alaister deleted the chore/useRegisterPage-swap-useMemo-for-useLayoutEffect branch January 31, 2026 08:44
@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

Braintrust eval report

Assistant (master-1769849196)

Score Average Improvements Regressions
Completeness 91.7% (+0pp) - -
Conciseness 0% (+0pp) - -
Goal Completion 100% (+8pp) 2 🟢 -
Tool Usage 100% (+0pp) - -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 80% (+0pp) - -
Docs Faithfulness 66.7% (-8pp) - 1 🔴
URL Validity 100% (+0pp) - -
Correctness 100% (+0pp) - -
Time_to_first_token 0.21tok (-0.07tok) 11 🟢 1 🔴
Llm_calls 8.25 (-0.25) 2 🟢 4 🔴
Tool_calls 3.33 (+0.25) 3 🟢 2 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 84342.67tok (-38225.5tok) 8 🟢 4 🔴
Prompt_cached_tokens 32746.67tok (-42816tok) 1 🟢 11 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 5801.17tok (+493.83tok) 6 🟢 6 🔴
Completion_reasoning_tokens 4106.67tok (+288tok) 5 🟢 7 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 90143.83tok (-37731.67tok) 9 🟢 3 🔴
Estimated_cost 0.03$ (+0$) 6 🟢 6 🔴
Duration 46.08s (+6.94s) 4 🟢 8 🔴
Llm_duration 91.33s (+14.18s) 4 🟢 8 🔴

awaseem pushed a commit that referenced this pull request Feb 3, 2026
…terPage (#42308)

This is largely to avoid setting state inside a `useMemo()`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Optimized CommandMenu page registration timing and dependency handling
to improve synchronization with DOM updates.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants