fix: replace useFetcher in AISettings with direct async fetch to unblock navigation#9954
fix: replace useFetcher in AISettings with direct async fetch to unblock navigation#9954jackkav wants to merge 4 commits into
Conversation
✅ Circular References ReportGenerated at: 2026-05-28T08:17:47.533Z Summary
Click to view all circular references in PR (18)Click to view all circular references in base branch (18)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
There was a problem hiding this comment.
Pull request overview
This PR addresses a navigation hang caused by AISettings (mounted via SettingsModal under <Modals />) registering a React Router fetcher through useOrganizationPermissions(), which could keep navigation from committing during logout → scratchpad flows.
Changes:
- Removed
useOrganizationPermissions()usage fromAISettings. - Added a
useEffectthat directly callsgetOrganizationFeatures()and stores results in local component state.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
25ad0c9 to
52f49b1
Compare
fiosman
left a comment
There was a problem hiding this comment.
Please help me understand if there is something wrong with the below flow:
- I enabled all AI features for my organization using the website app.
- On the desktop app, I do not see any of the toggles enabled by default within the AI Settings tab (I have a LLM configured).
- When I toggle them off via the website app, I can toggle them on and off in the desktop app. I was expecting not to be able to do that.
I'm not clear on the feature, @shelby-moore left the instructions that guided this flake fixing PR. https://kongstrong.slack.com/archives/C04RYC8GSJ0/p1778080551991569?thread_ts=1778062067.454049&cid=C04RYC8GSJ0 |
Thanks @jackkav. I also confirmed that AI features have to be toggled on for both the website app and the desktop app. https://kongstrong.slack.com/archives/C08E26ZEPL2/p1779875331434299?thread_ts=1779828345.613999&cid=C08E26ZEPL2 |
…rect async fetch AISettings is rendered inside SettingsModal (always-mounted via <Modals /> in root.tsx). useOrganizationPermissions internally creates a React Router useFetcher, which participates in the navigation lifecycle even when the modal is closed. When navigating to the scratchpad after logout, the fetcher's pending state prevented navigation from committing, causing a 30s hang in the bundling test. Replaced with a plain useEffect + getOrganizationFeatures call so no fetcher is registered against the router. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rect async fetch Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reset to fallbackFeatures when fetch condition is not met, and use a cancelled flag to ignore responses from outdated requests after unmount or dependency change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ondition When the user blurs a field immediately after typing (e.g. clicking Add Row), the 100ms debounce could fire after the subsequent write, overwriting the DB with stale kvPairs that didn't include the new row. Fix by: adding cancel() to misc.debounce, merging changes/blur into a single effect registered once via a ref (eliminating stale closures), and having blur explicitly cancel any pending debounce before flushing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52f49b1 to
22a9c79
Compare
Summary
AISettingsis rendered insideSettingsModal, which is always mounted via<Modals />inroot.tsxuseOrganizationPermissions()internally creates a React RouteruseFetcher, which participates in the navigation lifecycle even when the modal is closedawait next()never resolved, causing an indefinite hang (~30s timeout in the Windows bundling test)useEffect+ directgetOrganizationFeaturescall, so no fetcher is registered against the routerTest plan
npm run lint && npm run type-check🤖 Generated with Claude Code