fix(glossary): catch unhandled rejection in initializeGlossary on entity switch - #31711
Conversation
…ity switch When navigating from a glossary to a term, isGlossaryActive flips to false before the Zustand store updates activeGlossary, causing fetchGlossaryTermPermission to call GET /permissions/glossaryTerm with a glossary UUID → 400 from the backend. The permission helper already shows a toast and re-throws; initPermissions and initializeGlossary both lacked a catch, so the rejection propagated through the unawaited useEffect call and became an unhandled promise rejection. Add try/catch to initializeGlossary so the error is contained, loading state is always reset, and no unhandled rejection reaches the global error handler. Fixes: Sentry issue 7678621940
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ ApprovedCatches unhandled promise rejections during glossary permission initialization and entity switches, preventing global error crashes and stuck loading spinners. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
d08490c
|
Changes have been cherry-picked to the 2.0 branch. |
…ity switch (#31711) When navigating from a glossary to a term, isGlossaryActive flips to false before the Zustand store updates activeGlossary, causing fetchGlossaryTermPermission to call GET /permissions/glossaryTerm with a glossary UUID → 400 from the backend. The permission helper already shows a toast and re-throws; initPermissions and initializeGlossary both lacked a catch, so the rejection propagated through the unawaited useEffect call and became an unhandled promise rejection. Add try/catch to initializeGlossary so the error is contained, loading state is always reset, and no unhandled rejection reaches the global error handler. Fixes: Sentry issue 7678621940 (cherry picked from commit d08490c)
|
Changes have been cherry-picked to the 1.13 branch. |
…ity switch (#31711) When navigating from a glossary to a term, isGlossaryActive flips to false before the Zustand store updates activeGlossary, causing fetchGlossaryTermPermission to call GET /permissions/glossaryTerm with a glossary UUID → 400 from the backend. The permission helper already shows a toast and re-throws; initPermissions and initializeGlossary both lacked a catch, so the rejection propagated through the unawaited useEffect call and became an unhandled promise rejection. Add try/catch to initializeGlossary so the error is contained, loading state is always reset, and no unhandled rejection reaches the global error handler. Fixes: Sentry issue 7678621940 (cherry picked from commit d08490c)



Why
When navigating from a glossary page to a glossary-term page,
isGlossaryActiveflips tofalsebefore the ZustandactiveGlossarystore is updated with the term. TheuseEffectfires withisGlossaryActive = falsebutselectedData.idstill holds the glossary UUID.This causes
fetchGlossaryTermPermissionto call:The backend returns 400 because that UUID belongs to a Glossary, not a GlossaryTerm.
fetchGlossaryTermPermissionshows a toast and re-throws. NeitherinitPermissionsnorinitializeGlossaryhad acatch, and theuseEffectcallsinitializeGlossary()withoutawaitor.catch()— so the rejection became an unhandled promise rejection surfaced to the global error handler.Fix
Wrap
initializeGlossary's body in atry/catch. ThecatchresetsisLoadingso the spinner is never left hanging; the error toast is already shown byfetchGlossaryTermPermissionbefore it re-throws, so no second notification is needed.Test plan
isVersionsView = truepath is unchanged)🤖 Generated with Claude Code
Greptile Summary
The PR prevents a glossary permission-fetch failure from becoming an unhandled promise rejection and ensures the page loading state is cleared.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/glossary-un..." | Re-trigger Greptile