Skip to content

ui: honor the persisted Use Partial Response checkbox value - #9024

Open
shashankvarma499 wants to merge 2 commits into
thanos-io:mainfrom
shashankvarma499:fix/ui-use-partial-response-persistence
Open

shashankvarma499 wants to merge 2 commits into
thanos-io:mainfrom
shashankvarma499:fix/ui-use-partial-response-persistence

Conversation

@shashankvarma499

Copy link
Copy Markdown
  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

The query panel could never keep the "Use Partial Response" checkbox unchecked:

  • Panel.componentDidMount checked only for the presence of the usePartialResponse localStorage key and then unconditionally forced the value to true (in state, in the parent via onUsePartialResponseChange, and back into localStorage), so a stored "false" was overwritten on the next mount.
  • Panel.handleChangePartialResponse forced newValue back to true whenever the stored value was "true", so once true had ever been persisted the checkbox could not be unchecked again.

This restores the persisted boolean when the panel mounts and drops the forced override, so the checkbox reflects what the user last chose.

Fixes #8993

Verification

  • pnpm test src/pages/graph/Panel.test.tsx from pkg/ui/react-app: 13 passed, including three new tests covering the persistence behaviour.
  • The two behaviour tests fail against the previous implementation and pass with the fix (confirmed by re-running the suite with Panel.tsx reverted).
  • pnpm lint:ci and prettier --check are clean on the touched files.

The query panel forced usePartialResponse to true whenever the localStorage
key existed, and the change handler overrode an uncheck whenever "true" was
stored, so the checkbox could never be turned off.

Restore the persisted boolean when the panel mounts and drop the forced
override, so unchecking it survives a reload.

Fixes thanos-io#8993

Signed-off-by: Shashank Varma <324153016+shashankvarma499@users.noreply.github.com>
Signed-off-by: Shashank Varma <324153016+shashankvarma499@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui: 'Use Partial Response' checkbox can't stay off (forced back on after reload, then stuck)

1 participant