Skip to content

Replace useRecoilState with useSetRecoilState where relevant#664

Merged
Lucaci-Andrei merged 5 commits intomainfrom
fix/use-set-recoil-state
Mar 24, 2026
Merged

Replace useRecoilState with useSetRecoilState where relevant#664
Lucaci-Andrei merged 5 commits intomainfrom
fix/use-set-recoil-state

Conversation

@Lucaci-Andrei
Copy link
Copy Markdown
Contributor

@Lucaci-Andrei Lucaci-Andrei commented Mar 23, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Reduced unnecessary component re-renders by replacing read subscriptions with write-only state setters across multiple files.
    • Streamlined setter-only state updates for various UI and routing flows.
    • Improved app performance and responsiveness; changelog updated (release entry 1.96.15).

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 22e898e1-d4e2-4710-bad3-b2b94aee0498

📥 Commits

Reviewing files that changed from the base of the PR and between 3788eac and 96d8440.

📒 Files selected for processing (1)
  • packages/map-template/CHANGELOG.md

📝 Walkthrough

Walkthrough

Replaced useRecoilState with useSetRecoilState across 17 files in the map-template package where only the setter was used, removing unnecessary Recoil value subscriptions while preserving existing setter calls and behavior.

Changes

Cohort / File(s) Summary
Changelog
packages/map-template/CHANGELOG.md
Updated release entry to ## [1.96.15] - 2026-03-24 and added a ### Fixed note describing replacement of useRecoilState with useSetRecoilState in 17 files.
Major / MapTemplate
packages/map-template/src/components/MapTemplate/MapTemplate.jsx
Replaced many useRecoilState(atom) patterns that only used setters with useSetRecoilState(atom) across API, UI, and settings atoms; imports updated accordingly.
Components — Multiple (setter-only)
packages/map-template/src/components/ChatWindow/ChatSearchResults/ChatSearchResults.jsx, packages/map-template/src/components/Search/Categories/Categories.jsx, packages/map-template/src/components/Wayfinding/Wayfinding.jsx, packages/map-template/src/components/VenueSelector/VenueSelector.jsx, packages/map-template/src/components/WebComponentWrappers/RouteInstructionsStep/RouteInstructionsStep.jsx, packages/map-template/src/components/WebComponentWrappers/Search/Search.jsx
Switched const [, setX] = useRecoilState(...) to const setX = useSetRecoilState(...) for atoms where only setters were used; imports adjusted.
Components — Medium scope
packages/map-template/src/components/BottomSheet/BottomSheet.jsx, packages/map-template/src/components/Directions/Directions.jsx, packages/map-template/src/components/LocationDetails/ShareLocationLink/ShareLocationLink.jsx, packages/map-template/src/components/RouteInstructions/RouteInstructions.jsx, packages/map-template/src/components/Sidebar/Sidebar.jsx, packages/map-template/src/components/MapWrapper/MapWrapper.jsx
Converted specific useRecoilState usages that discarded the value to useSetRecoilState; retained original setter calls and effects unchanged.
Search / UI
packages/map-template/src/components/Search/Search.jsx
Replaced several setter-only useRecoilState usages with useSetRecoilState for filtered/search/location-related atoms; imports adjusted.
Hooks
packages/map-template/src/hooks/useChat.js, packages/map-template/src/hooks/useCurrentVenue.js, packages/map-template/src/hooks/useDirectionsInfo.js, packages/map-template/src/hooks/useReset.js
Updated hooks to use useSetRecoilState where only setters were needed; dependency arrays and setter references updated accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • matbmapspeople

Poem

🐇 I hopped through seventeen lines of state,

swapped reads for setters — tidy and great.
No extra listens, fewer re-runs,
lighter renders, nimble hops and suns.
A carrot dance for cleaner traits! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change across 17 files: replacing useRecoilState with useSetRecoilState where only the setter function is used, eliminating unnecessary state subscriptions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 fix/use-set-recoil-state

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.

}, [language, appConfig, currentLanguage, setCurrentLanguage, userSelectedLanguage]);

return (
<GeminiProvider enabled={appConfig?.appSettings?.enableChat === 'true'}>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This has to be reverted?

@Lucaci-Andrei Lucaci-Andrei merged commit 8a41164 into main Mar 24, 2026
@Lucaci-Andrei Lucaci-Andrei deleted the fix/use-set-recoil-state branch March 24, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants