Skip to content

Iss2444 - Fix saved queries not persisting timeframe radio selections#278

Open
jadecarino wants to merge 2 commits intogalasa-dev:mainfrom
jadecarino:iss2444-saved-queries-bug
Open

Iss2444 - Fix saved queries not persisting timeframe radio selections#278
jadecarino wants to merge 2 commits intogalasa-dev:mainfrom
jadecarino:iss2444-saved-queries-bug

Conversation

@jadecarino
Copy link
Copy Markdown
Member

@jadecarino jadecarino commented Mar 31, 2026

Why?

Fixes galasa-dev/projectmanagement#2444

Problem

When switching between saved queries with different timeframe configurations, the radio button selections for "From" and "To" time options were not being preserved correctly, causing two problems:

  1. Radio button state inconsistency: Switching between queries (e.g., "Duration + Now" to "Specific Time + Specific Time") would show incorrect radio button selections
  2. Save button not enabling: The Save Query button would not enable when toggling between radio button options, even though the selection had changed

Cause of bug: Radio button selections were stored only in local component state and never persisted to the URL. The component relied on isRelativeToNow to infer which radio buttons should be selected, but this approach could not distinguish between all four valid combinations (Duration+Now, Duration+Specific, Specific+Now, Specific+Specific) and did not preserve the saved query configuration when switching between queries.

isRelativeToNow:
The isRelativeToNow property is still required to control runtime behavior (whether "To" date is dynamic new Date() or fixed) but should have never been used to populate radio button selections when switching between queries.

Changes

  • Added explicit URL parameters (fromOption and toOption) to persist radio button selections.
    • Added FROM_OPTION and TO_OPTION to TEST_RUNS_QUERY_PARAMS
    • Added fromOption?: string and toOption?: string to TimeFrameValues
  • Context now reads fromOption/toOption from URL parameters when loading queries and writes fromOption/toOption to URL parameters when state changes which is persisted with the saved query
  • TimeFrameContent now includes radio button selections in state updates and syncs radio buttons from URL parameters when queries load
  • Unit test for this scenario has been updated (verifies radio buttons sync correctly when loading queries with explicit parameters) and passing
  • Manual testing confirms radio buttons persist correctly across query switches
  • Save button enables appropriately when selections change

@jadecarino jadecarino requested a review from eamansour March 31, 2026 15:37
Signed-off-by: Jade Carino <carino_jade@yahoo.co.uk>
Signed-off-by: Jade Carino <carino_jade@yahoo.co.uk>
@jadecarino jadecarino force-pushed the iss2444-saved-queries-bug branch from 3331f43 to d4da5ec Compare April 2, 2026 10:18
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.

Query time options and Save button state not updating correctly when switching between saved queries

1 participant