8000 Keep translation row drafts independent by FayezBast · Pull Request #55562 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Keep translation row drafts independent - #55562

Open
FayezBast wants to merge 2 commits into
keycloak:mainfrom
FayezBast:fix/translation-row-drafts
Open

FayezBast wants to merge 2 commits into
keycloak:mainfrom
FayezBast:fix/translation-row-drafts

Conversation

@FayezBast
Copy link
Copy Markdown

In Realm settings → Localization → Realm overrides, inline editors share one draft value and track edits by row index. Opening a second editor can overwrite the first row’s draft. Filtering or paging can also move an open editor to a different translation.

Key drafts by realm, locale, and translation key. Saving or canceling affects only that row, and failed saves keep the draft available for retry. Search and pagination reload saved translations while preserving open drafts.

Remove confirmed deletions from the table immediately, including successful deletions in a partially failed batch. Ignore superseded fetch responses so they cannot restore deleted rows.

Verified with six Chromium localization tests and six supplemental checks covering concurrent saves, pagination, partial deletes, and stale responses. TypeScript, Prettier, and Spotless passed.

I used an AI coding agent to implement and verify this change.

Signed-off-by: FayezBast <fayezbast15@gmail.com>
@FayezBast
FayezBast requested review from a team as code owners November 26, 2026 00:11
Copilot AI balanced review requested due to automatic review settings November 26, 2026 00:11
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A committed regression test is missing for failed inline-save retries, including preserving the editable draft, leaving other rows’ drafts unchanged, and persisting the value after retry.

1 open issue
What changed in this PR

This PR makes inline translation drafts independent in Realm settings → Localization → Realm overrides, preserving edits across filtering and pagination.

Changes:

  • Keys drafts by realm, locale, and translation key, with row-specific save, cancel, and retry handling.
  • Removes confirmed deletions locally and guards against superseded fetch responses.
  • Updates row-based test helpers and adds coverage for independent drafts, locale switching, and reload behavior.
File Description
js/​apps/​admin-ui/​test/​realm-settings/​localization.ts Uses row locators for inline editing helpers.
js/​apps/​admin-ui/​test/​realm-settings/​localization.spec.ts Expands draft isolation, search refresh, deletion, and locale-switching tests.
js/​apps/​admin-ui/​src/​realm-settings/​localization/​RealmOverrides.tsx Introduces scoped drafts and safer save, delete, and refresh handling.

Review effort: Balanced

Comment on lines +344 to +346
setDrafts((previous) =>
previous[id] === savingDraft ? { ...previous, [id]: draft } : previous,
);
Signed-off-by: FayezBast <fayezbast15@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 00:51
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Successful deletions remain visible until the entire batch finishes, so removal and read invalidation must occur after each successful DELETE to provide immediate feedback.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Remove each item immediately after its DELETE succeeds

js/​apps/​admin-ui/​src/​realm-settings/​localization/​RealmOverrides.tsx:288

Local removal and read invalidation run only after the entire batch finishes, so a successful first DELETE remains visible while a later DELETE is slow or stalled. Apply removal and invalidation after each successful DELETE to meet the promised immediate-removal behavior, keeping batch-level cleanup in finally.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0