Skip to content

fix(glossary): catch unhandled rejection in initializeGlossary on entity switch - #31711

Merged
anuj-kumary merged 3 commits into
open-metadata:mainfrom
anuj-kumary:fix/glossary-unhandled-rejection
Aug 19, 2026
Merged

fix(glossary): catch unhandled rejection in initializeGlossary on entity switch#31711
anuj-kumary merged 3 commits into
open-metadata:mainfrom
anuj-kumary:fix/glossary-unhandled-rejection

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Aug 18, 2026

Copy link
Copy Markdown
Member

Why

When navigating from a glossary page to a glossary-term page, isGlossaryActive flips to false before the Zustand activeGlossary store is updated with the term. The useEffect fires with isGlossaryActive = false but selectedData.id still holds the glossary UUID.

This causes fetchGlossaryTermPermission to call:

GET /api/v1/permissions/glossaryTerm/<glossary-uuid>

The backend returns 400 because that UUID belongs to a Glossary, not a GlossaryTerm.

fetchGlossaryTermPermission shows a toast and re-throws. Neither initPermissions nor initializeGlossary had a catch, and the useEffect calls initializeGlossary() without await or .catch() — so the rejection became an unhandled promise rejection surfaced to the global error handler.

Fix

Wrap initializeGlossary's body in a try/catch. The catch resets isLoading so the spinner is never left hanging; the error toast is already shown by fetchGlossaryTermPermission before it re-throws, so no second notification is needed.

Test plan

  • Navigate from a glossary to one of its child terms — no unhandled rejection in the browser console
  • Glossary permission 403 / 400 shows a toast but does not crash the page or leave a spinner stuck
  • Version view still works (isVersionsView = true path 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.

  • Wraps glossary initialization in error handling.
  • Preserves the existing permission error notification without displaying a duplicate toast.
  • Clears the loading state when permission initialization fails.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryV1.component.tsx Adds targeted rejection handling around permission initialization and clears loading state on failure.

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/glossary-un..." | Re-trigger Greptile

…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
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@anuj-kumary anuj-kumary self-assigned this Aug 18, 2026
@github-actions github-actions Bot added the UI UI specific issues label Aug 18, 2026
@anuj-kumary anuj-kumary added skip-pr-checks Bypass PR metadata validation check and removed UI UI specific issues labels Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Aug 18, 2026
@github-actions github-actions Bot added UI UI specific issues and removed safe to test Add this label to run secure Github workflows on PRs labels Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Aug 18, 2026
@gitar-bot

gitar-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Catches unhandled promise rejections during glossary permission initialization and entity switches, preventing global error crashes and stuck loading spinners. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 66%
66.89% (80117/119761) 51.24% (48854/95329) 52.29% (14642/28001)

@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Aug 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

@anuj-kumary
anuj-kumary enabled auto-merge August 19, 2026 02:44
@anuj-kumary
anuj-kumary added this pull request to the merge queue Aug 19, 2026
@anuj-kumary anuj-kumary added the To release Will cherry-pick this PR into the release branch label Aug 19, 2026
Merged via the queue into open-metadata:main with commit d08490c Aug 19, 2026
209 of 217 checks passed
@anuj-kumary
anuj-kumary deleted the fix/glossary-unhandled-rejection branch August 19, 2026 12:38
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 2.0 branch.

github-actions Bot pushed a commit that referenced this pull request Aug 19, 2026
…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)
@github-actions

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 1.13 branch.

github-actions Bot pushed a commit that referenced this pull request Aug 19, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check To release Will cherry-pick this PR into the release branch UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants