perf(ui): fetch database in parallel with permission on DatabaseDetailsPage (W1 template) - #30867
perf(ui): fetch database in parallel with permission on DatabaseDetailsPage (W1 template)#30867harsh-vador wants to merge 1 commit into
Conversation
…lsPage (W1 template) The database GET was gated on the permission fetch resolving first (useQuery enabled: hasViewBasicPermission && !permissionsLoading), so every mount paid two serial round-trips. Now the GET fires in parallel with the permission fetch. To preserve the no-permission UX now that the GET runs speculatively: - enabled is gated only on the FQN, so the query fires immediately. - render checks !hasViewBasicPermission BEFORE isError, so a no-permission user's 403 shows the inline PERMISSION placeholder, not the generic error. - the FORBIDDEN redirect fires only on a genuine permission desync (hasViewBasicPermission true but backend denied), not for a normal no-permission user. Added a regression unit test asserting a no-permission user gets the PERMISSION placeholder (no generic error, no forbidden redirect) and that the database GET is still fired in parallel. All 5 DatabaseDetailsPage tests pass; eslint clean. This is the template for the W1 waterfall fix (audit lists ~7 primary-render pages with the same permission-gates-fetch shape). The remaining pages will follow the same three-part pattern. The 403/permission UX is best confirmed in a running app / Playwright in addition to the unit guard. Ref: open-metadata/openmetadata-collate#5442 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
❌ 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! |
Code Review ✅ ApprovedFetches database details in parallel with permission checks on DatabaseDetailsPage to eliminate request waterfalls, preserving the no-permission UX. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
✅ Playwright Results — workflow succeededValidated commit ✅ 549 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 51m 51s ⏱️ Max setup 3m 31s · max shard execution 17m 52s · max shard-job elapsed before upload 21m 29s · reporting 5s 🌐 201.44 requests/attempt · 2.83 app boots/UI scenario · 17.07% common-shard skew Optimization targets still in progress:
🟡 1 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
|
|
|
Closing after reconsidering the approach. |



Fixes 5445
Description
The database detail page paid two serial round-trips on every mount: a permission fetch, then a database
useQuerygated on the permission resolving (enabled: hasViewBasicPermission && !permissionsLoading). This fires the database GET in parallel with the permission fetch instead.This is the template for the W1 request-waterfall fix — the audit lists ~7 primary-render pages (SearchIndexDetailsPage, Database/DatabaseSchema/Version pages, StoredProcedurePage, APICollectionPage) with the identical permission-gates-fetch shape. Reference parallel pattern already in the tree:
PlatformLineage.tsx.Preserving the no-permission UX (the subtle part)
Because the GET now runs speculatively, a no-permission user's GET returns 403. Three coordinated changes keep the prior behaviour exactly:
enabledis gated only on the FQN → the query fires immediately, in parallel.!hasViewBasicPermissionbeforeisError→ a no-permission 403 shows the inline PERMISSION placeholder, not the generic error placeholder./forbiddenredirect fires only on a genuine permission desync (hasViewBasicPermissiontrue but the backend still denied), never for a normal no-permission user.Type of change
Tests
Verification note
The 403 / permission UX is guarded by the new unit test, but is best also confirmed in a running app / Playwright (Jest mocks permissions and does not exercise the real backend 403 path). Recommend a manual/Playwright pass on: (a) happy path, (b) no-permission user sees the inline placeholder and is not redirected to /forbidden.
Ref: open-metadata/openmetadata-collate#5442