Skip to content

fix(ui): settings modal unsaved-changes guard, Back navigation, compact Members pager and consistency fixes - #37904

Merged
Rohit0301 merged 13 commits into
mainfrom
Rohit0301/settings-ux-remaining
Nov 17, 2026
Merged

Rohit0301 merged 13 commits into
mainfrom
Rohit0301/settings-ux-remaining

Conversation

@Rohit0301

@Rohit0301 Rohit0301 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

These are the remaining settings-modal (AI mode) UI-review fixes. The first batch was #37878.

Related: open-metadata/openmetadata-collate#8625 (unsaved-changes guard across settings forms).

Behaviour

  • Unsaved changes are no longer lost. Every Platform Settings form now asks before Esc, Close, a sidebar item, a breadcrumb or Cancel would drop its edits ("Continue editing" / "Discard & go"). The guard is shared: useUnsavedExitGuard plus UnsavedChangesPrompt, which Personas now uses too.
    • There is no "Save & go" here: settings saves report failure only through a toast, so leaving after a failed save would lose the edits. Personas keeps its "Save & go".
  • Every settings form asks before dropping edits, not only Platform Settings. useUnsavedChangesPrompt (guard + prompt) is wired into Bots (Add), Access Control (Add Role, Add Policy, Add/Edit Rule), Alerts (Add/Edit), Custom Properties (Add, Edit), Personas (Add), Members (Create User/Admin, Add Team), Governance (Intake Form), Applications (config) and Account (Change Password).
    • ProfilePage now guards every panel's breadcrumbs once (guardBreadcrumbAction), so panels pass plain navigation and Discard never asks twice.
    • Nested forms report changes through onDirtyChange (custom property edit form, intake designer). Alerts and Applications compare against what they loaded, so an untouched form never asks.
    • Checked in the browser for every form: an untouched form leaves freely, and an edited one asks.
  • Browser Back stays in settings. Opening a Platform Settings view now pushes a history entry, and leaving an editor (Save or Cancel) replaces it. Back from a sub-page now returns to Platform Settings instead of closing the modal, and never reopens a saved form. The amendment to ADR:2026-11-12-settings-modal-views-push-history-only-when-the-user-opens-them is in this PR.
  • Compact pager on Members › Users, Admins and Online Users, the same as the Teams list ("< Page 1 of N > · Records"). Previous uses the shown page's before cursor and Next its after; useCursorPageJump caches each page's paging (bounded at 100) and, when Next is pressed before a page lands, walks one page requesting cursors only. Recorded in ADR:2026-11-17-members-user-lists-use-the-compact-pager, which narrows ADR:2026-10-16-cursor-paged-lists-jump-by-walking for these lists.
  • One Back rule for every settings panel (settingsHashOptions in utils/SettingsHistory.utils.ts, ADR v4 amendment): opening a view pushes, leaving a form replaces, and returning to a list after a delete or uninstall replaces, so Back never lands on a removed entity.

Consistency

  • Timestamps use formatDateTimeLong: Learning Resources "Updated at", the bot token "Created on", and MCP clients. Announcements stay date-only on purpose, since they are scheduled by day.
  • Empty table cells use NO_DATA_PLACEHOLDER everywhere. Custom Properties used "—".
  • The Access Token empty state uses the shared placeholder (icon box), with the expiry and Generate controls in its footer.
  • Custom Properties entity pages (e.g. Tables) use the solid header icon like every other page.
  • Audit Logs content lines up with the other pages (px-8).

Known gap: browser Back on an editor with unsaved changes still leaves without asking. The browser does not let the app intercept Back (no popstate guard), and Platform Settings now adds a history entry for each editor it opens, so Back is a more common way out than before. ADR:2026-11-12-settings-modal-views-push-history-only-when-the-user-opens-them (v3) records this.

Not changed: the Weekly emails alignment, which is expected.

Collate companion PR: Ingestion Runners ?currentPage=1, the Provisioning dark-mode empty state, SCIM/runner dates and the Billing seats bar colour.

Type of change:

  • Bug fix

High-level design:

  • hooks/useUnsavedExitGuard.ts: registers the modal-level exit guard (Esc, Close, sidebar) while dirty and holds the in-panel exits (runGuarded). It anchors the prompt to the last pressed control.
  • SettingsFormLayout (which every Platform Settings form renders through) uses it with form.formState.isDirty. The breadcrumbs go through the same guard.
  • PlatformSettingsPanel.onNavigate pushes unless isLeavingEditor(current, next).
  • hooks/paging/useCursorPageJump.ts: a bounded per-page paging cache (100 entries, as in useCursorPagedList), plus cursorFor(target, current) and reset().

Tests:

Use cases covered

  • Lineage edit → sidebar click asks first, Continue editing keeps the value, Esc asks again, and Discard closes without saving.
  • Back from a detail view (Lineage, bots, roles, policies, alerts, teams, custom properties, governance, SSO, applications) returns to its list and keeps the modal open. Back never reopens a form that was saved or cancelled.
  • Users, Admins and Online Users use the same compact pager as Teams; Previous from page 3 requests page 2 with page 3's before cursor.
  • Teams paging falls back to search paging when the teams API returns no cursor.
  • Untouched forms leave without asking (Applications config, alert edit, intake form undone, new SSO setup); edited ones ask (policy rule description/condition, glossary relation, announcement, schedule, import, SSO via the popover).

Unit tests

  • New: SettingsFormLayout.test.tsx, useCursorPageJump.test.ts, toSettingsHistoryView, SettingsHistory.utils.test.ts (push vs replace rule, replace option), useUnsavedExitGuard.test.ts, UnsavedChangesPrompt.test.tsx, useSsoFormDirty.test.ts, Previous-with-before and stale-page tests in MembersUsersPanel.test.tsx.
  • Updated: panel tests for the push/replace setHash call, SsoConfigureForm (popover; untouched new provider leaves without asking), GovernanceGlossaryFormPage.
  • Settings modal, SSO, announcements, settings hash and paging hooks: 251 suites / 2701 tests pass. No type errors in changed files.

Playwright (run locally against this branch, --no-deps)

SettingsUnsavedChanges.spec.ts, ProfilePlatformSettings.spec.ts, ProfileMembers.spec.ts: 47 passed, 0 failed, 0 flaky (1.6m).

  • New: ProfilePlatformSettings.spec.ts › "lineage: asks before leaving unsaved edits, and only Discard drops them".
  • New: ProfilePlatformSettings.spec.ts › "browser Back walks the opened views and never reopens a saved form".
  • New: SettingsUnsavedChanges.spec.ts › untouched Applications config / alert edit / undone intake edit leave without asking.
  • New: ProfileMembers.spec.ts › "Should ask before a breadcrumb or Cancel drops a typed team".
  • Updated: ProfileMembers.spec.ts › Admins Next/Previous and Users "go back a page with the before cursor" for the compact pager.
  • yarn lint:playwright: 0 errors.

Recording

settings-modal-behaviour.webm

Screenshots

Unsaved changes prompt (sidebar switch on a dirty Lineage form)
Unsaved changes prompt

Any settings form: Add Role asks before Cancel drops the typed name
Add Role prompt

Members › Users: compact pager
Users pager

Members › Admins
Admins pager

Members › Online Users
Online users pager

Access Token empty state: shared placeholder
Access token

Custom Properties › Tables: solid header icon, "--" for empty cells
Custom properties

Audit Logs: lines up with the other pages
Audit logs

Learning Resources: long date format
Learning resources

Bot token "Created on": long date format
Bot token

🤖 Generated with Claude Code


Summary by Gitar

  • Race fixes:
    • Stale user searches and superseded page jumps in Members lists no longer overwrite newer results via latestLoadIdRef

This will update automatically on new commits.

RetriggerView in GreptileConfidence Score: 5/5

The changes appear safe to merge, with no new actionable issue confirmed.

Summary

The PR shares unsaved-change prompts across settings forms and makes settings navigation follow one history rule.

  • Dirty settings forms ask before an exit drops their edits.
  • Settings Back navigation returns to the view someone just left.
  • Members lists use a compact pager that can move between cursor-based pages.
  • Shared date, empty-state, and page styling keeps settings screens consistent.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[User leaves a settings form] --> B{Unsaved edits?}
  B -->|No| C[Navigate]
  B -->|Yes| D[Show prompt]
  D -->|Continue editing| E[Keep form open]
  D -->|Discard| C
  D -->|Save and go in Personas| F{Save succeeds?}
  F -->|No| E
  F -->|Yes| C
  C --> G[Replace history when leaving a form]
Loading

Reviews (15) · Last reviewed commit: "chore: drop an unrelated api-reference r..." · Reviewed by Greptile

…nsistency fixes

- Platform Settings forms ask before Esc, close, the sidebar, breadcrumbs or
  Cancel drop unsaved edits (shared useUnsavedExitGuard + UnsavedChangesPrompt,
  also used by Personas)
- Opening a Platform Settings view pushes history, leaving an editor replaces,
  so browser Back returns to Platform Settings instead of closing the modal
- Members Users, Admins and Online Users use the numbered pager, reaching any
  page through the cursor-paged API (useCursorPageJump)
- Timestamps use formatDateTimeLong; empty cells use NO_DATA_PLACEHOLDER
- Access Token empty state uses the shared placeholder
- Custom Properties entity pages use the solid header icon
- Audit Logs content lines up with the other pages
@Rohit0301
Rohit0301 requested a review from a team as a code owner November 16, 2026 13:51
@Rohit0301
Rohit0301 requested a review from karanh37 November 16, 2026 13:51
@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.

@Rohit0301 Rohit0301 added the safe to test Add this label to run secure Github workflows on PRs label Nov 16, 2026
- useUnsavedChangesPrompt wraps the shared guard and prompt for a form
- ProfilePage guards every panel's breadcrumbs once; panels pass plain
  navigation, so Discard never asks twice
- Bots, Access Control (role, policy, rule), Alerts, Custom Properties (add,
  edit), Personas, Members (user, team), Intake Forms, Applications config
  and Change Password ask before Cancel, Esc, Close, the sidebar or a
  breadcrumb drops their edits
- Nested forms (custom property edit, intake designer) report onDirtyChange
…uards

- Users and Online Users ignore responses from superseded loads, so a slow
  page can no longer replace the page you are on; a failed page jump toasts
- Platform Settings redirects run from an effect replace history, so Back
  does not land on a stale link and redirect again
- Settings forms stay guarded while a save is pending
- The Applications config form derives its unsaved state from the live data,
  so it reads clean again once a save updates the app
- Add forms (Bot, Role, Policy, Persona, Team, User) guard description
  editor and domain picker edits, which live outside the form state
- The intake designer compares rows with their starting values, so an edit
  that was undone no longer asks
…ewer results

- A superseded user search no longer clears the table or the loading state
- Starting a search drops any page jump still walking (Users, Online Users)
…ne tests

- useUnsavedExitGuard moves to hooks/discovery/personal-space/
- toOptionalNumber gets its JSDoc back; description-only forms describe their
  guard correctly; the entity-icon assertion states why it holds
- Playwright: untouched Applications config, alert edit and intake forms leave
  without asking; an intake row toggled back reads clean; Members Users picks
  its page size and goes back a page with the before cursor
…uard remaining forms

- Every settings panel pushes a history entry for a view the user opens, so
  Back returns to the list; a form returning replaces, so Back never reopens it.
- Users, Admins and Online Users use the compact pager the Teams list uses;
  Teams paging falls back to search when the API returns no cursors.
- Policy rule description/condition edits mark the form dirty.
- The settings-modal SSO form asks through the unsaved-changes popover (classic
  SSO keeps its dialog) and compares through comparableFormData, so RJSF default
  filling never reads as an edit.
- Glossary relation, announcement, schedule and import forms ask before leaving.
… safe Save & go

- useUnsavedChangesPrompt is a plain hook in src/hooks returning promptProps;
  every form renders <UnsavedChangesPrompt {...promptProps} /> itself.
- Save & go leaves only when the editor reports the save landed.
- Every settings panel uses settingsHashOptions; returning to a list after a
  delete or uninstall replaces, so Back never lands on a removed entity.
  Platform Settings and Custom Properties follow the same rule.
- SSO header tabs and Change provider ask before dropping edits.
- The exit-guard slot is cleared only by the editor that holds it.
- Members cursor walks request cursors only; cursorless team pages keep the
  name order.
- Records: compact Members pager (narrows the jump-by-walking record), v4
  amendment to the settings history record.
- Tests for the exit guard, prompt, SSO dirty check and history helpers.
@Rohit0301 Rohit0301 changed the title fix(ui): settings modal unsaved-changes guard, Back navigation, numbered Users pager and consistency fixes fix(ui): settings modal unsaved-changes guard, Back navigation, compact Members pager and consistency fixes Nov 17, 2026
@gitar-bot

gitar-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 6 closed / 6 findings

Shared unsaved-change guards and cursor-based Members pagination alter settings navigation and list loading; cursor errors could show the wrong users or page.

Settings modal now guards unsaved edits across forms, keeps browser Back inside settings, and uses a compact pager on Members lists. Resolved out-of-order page fetches and a stale dirty flag after save that caused prompts on leave. No open issues remain; the stale-search, pending-walk, numbered-jump, and cursorless sort findings are closed without a fix in this PR.

✅ 6 closed
✅ Bug: Out-of-order page fetches can show one page's rows under another number

📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.tsx:156-170 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.tsx:243-257 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.tsx:507-514 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersOnlineUsersPanel.tsx:116-130 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersOnlineUsersPanel.tsx:366-373
The old NextPrevious took isLoading, which disabled the pager while a page was loading. PaginationCardWithControls gets no loading flag, so the user can click another page while a request is still in flight. Page jumps can now take several requests, which makes this more likely.

useCursorPageJump only drops a stale walk. fetchUsers and fetchOnlineUsers have no request-id guard and always call setUsers, setPaging and rememberPage. Example: click page 2, then quickly page 3. The page-3 walk fetches page 2's paging for its cursor and loads page 3. If the first page-2 getUsers resolves after that, the table shows page 2's rows while the hash and pager say 3. The late response also overwrites paging, so the cached cursors are wrong for the next Prev/Next.

The same gap applies to a late page-1 response. It calls resetPages(), which wipes cursors that newer pages already cached.

Fix: add a fetchRequestIdRef guard, as NotificationAlertsPanel and AccessControlRolesPanel already do, so only the latest request writes state.

✅ Bug: AppConfigForm stays dirty after a successful save, so leaving prompts

📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/applications/AppConfigForm.tsx:186-196 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/applications/AppConfigForm.tsx:212-214
isDirty in AppConfigForm is a useState flag that only onChange writes. Nothing clears it after a successful save. Both hosts keep the form mounted after saving: AppDetail.handleConfigSave patches the app and stays on the page, and useMcpConfiguration.saveMcpConfig applies the new config without navigating. After one save, isDirty && !isSaving is true again, so useUnsavedExitGuard re-registers the modal exit guard. Cancel, the sidebar, breadcrumbs, Esc and Close then all show "unsaved changes" for edits that were already saved. When McpConfigForm passes in a new formConfig, savedFormData is recomputed but the stale flag is not.

Fix: keep the current RJSF form data in state and derive isDirty with useMemo against savedFormData, so it follows saved-data updates. AppDetail also needs to refresh appData from the patch response so the baseline moves forward.

Closed: Edge Case: Stale searchUsers error/finally still clobbers the newer shared load

📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.tsx:194-208
This commit makes fetchUsers and searchUsers share latestLoadIdRef. fetchUsers only touches state when its load is still the latest, but searchUsers checks the id only on success. Its catch (setUsers([]) plus a toast) and its finally (setIsLoading(false)) still run when the search is stale. Example: a search request is in flight, the user clears the box, and fetchUsers() starts. If the old search then fails, it empties the table that the newer list load filled. If it settles while the list is still loading, it turns the loading state off early. Guard catch and finally with searchId === latestLoadIdRef.current, as fetchUsers and the Online Users panel already do.

Closed: Edge Case: A pending page walk can overwrite search results after the user searches

📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.tsx:231-242 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.tsx:252-266
handlePageNavigation waits for cursorFor, which can walk several intermediate pages. That walk is dropped only when latestJump changes, which happens on a newer cursorFor call or on resetPages. handleSearch does neither: searchUsers never calls resetPages. If the user jumps to a far page and types a search before the walk finishes, the walk completes and runs handlePageChange(newPage) and then fetchUsers(cursor). That bumps latestLoadIdRef after the search did, so the unfiltered list page replaces the search results even though the search box still shows a query. Fix: call resetPages() in handleSearch (or in searchUsers) so the pending walk becomes stale, or check searchValue again after await cursorFor before fetching.

Closed: Quality: Minimal Users pager drops numbered jumps the ADR and PR promise

📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.tsx:533-536 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersOnlineUsersPanel.tsx:402-405 📄 openmetadata-ui/src/main/resources/ui/src/components/discovery/personal-space/Profile/tabs/members/MembersUsersPanel.test.tsx:250 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/AIProfile/ProfileMembers.spec.ts:552-555
This commit sets minimal on the Members Users and Online Users pagers, which removes numbered pages and the page input. It also deletes the unit and Playwright tests that covered jumping to an unvisited page. The Accepted record docs/decisions/2026-10-16-cursor-paged-lists-jump-by-walking.md says "Cursor-paged settings lists reach any page number by walking cached cursors". The PR title ("numbered Users pager") and the description ("Members Users jump walks intermediate cursor pages to reach the target page") still describe the old behaviour, but the code now only steps ±1 and useCursorPageJump's walk can no longer be reached from these panels. There are two ways to resolve this: drop minimal and restore the jump tests, or add a record that supersedes or narrows the 2026-10-16 one, stating that "Members user lists, which can grow to many pages, use the compact prev/next pager and do not offer numbered jumps", and update the description to match.

...and 1 more closed from earlier reviews

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@Rohit0301
Rohit0301 merged commit a8e71de into main Nov 17, 2026
65 of 71 checks passed
@Rohit0301
Rohit0301 deleted the Rohit0301/settings-ux-remaining branch November 17, 2026 06:46
harsh-vador added a commit that referenced this pull request Nov 17, 2026
main went stale after #37953 and #37904 changed imports without
regenerating it, which fails the impact-map drift check on every PR.
harsh-vador added a commit that referenced this pull request Nov 18, 2026
* fix(ui): bump @apidevtools/json-schema-ref-parser to 15.3.6

CVE-2026-15195 (prototype pollution in Pointer.set) affects every
version below 15.3.6, including the 14.1.1 the UI resolved. Collate
already pins 15.3.6, so this also aligns the two UIs on one major.

15.x ships an ESM `import yaml from "js-yaml"`, and js-yaml 5 has no
default export, so a scoped resolution keeps js-yaml 4.3.2 under the
parser only; it must stay above the bare js-yaml entry.

parseSchemas.js passed its options to the $RefParser constructor,
which never read them. They now go on every call, with a JSON parse
plugin that drops `$id`: under 2020-12 15.x resolves $refs against
`$id`, and 122 spec schemas declare an `$id` that does not match their
file path, so refs fetched open-metadata.org instead of the local file.

The regenerated output differs only in five ingestion schemas, where
22 bundle-internal $refs pointed through another $ref and resolved
nowhere; all 22 now resolve.

* test(ui): assert every local $ref in generated schemas resolves

Fails on main's output with 22 dangling pointers in five ingestion
schemas; also drop the now-redundant post-bundle $id strip, since the
parse plugin removes $id when each file is read.

* docs(decisions): record why the ref-parser js-yaml pin precedes bare js-yaml

Yarn 1 applies the first matching resolution, so the scoped js-yaml 4.3.2
entry must stay above the bare js-yaml entry; package.json cannot carry
that comment. The record also says when the pin can go: ref-parser 16.x
depends on js-yaml ^5.

* test(ui): resolve $refs the way RJSF does in the generated-schema guard

URI-decode the fragment and keep empty pointer tokens, so
'#/definitions//x' no longer passes against a missing empty key; cover
empty, escaped and URI-encoded keys.

* chore(playwright): regenerate the impact map

main went stale after #37953 and #37904 changed imports without
regenerating it, which fails the impact-map drift check on every PR.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants