Skip to content

Umbrella: roll out filter param validation fix to all findable-ui clients #900

@frano-m

Description

@frano-m

Summary

findable-ui#899 adds defensive validation for filter URL parameters to prevent crashes in ExploreStateProvider's reducer and surfaces meaningful errors to the user via the useValidateFilterParam hook inside the ErrorBoundary.

However, the original data-browser#4783 also moved ExploreStateProvider and DataDictionaryStateProvider inside the ErrorBoundary in pages/_app.tsx. This structural change needs to be revertedExploreStateProvider must remain outside the ErrorBoundary to preserve state across page navigations.

What changed in findable-ui

  1. parseFilterParam + isSelectedFilter — shared validation in common/filters/typeGuards.ts. Safely parses filter params; must not throw (called from reducers above ErrorBoundary).
  2. useValidateFilterParam hook — validates filter param inside ErrorBoundary, throws DataExplorerError for invalid filters so the error page renders.
  3. decodeFilterParamValue / initFilterState — delegate to parseFilterParam instead of raw JSON.parse.
  4. ErrorBoundary — fix this.renderthis.reset typo.
  5. useAsync.run() — clear stale error on new request.

Ask

For each findable-ui consumer:

  1. Revert ExploreStateProvider / DataDictionaryStateProvider to their original position outside the ErrorBoundary in pages/_app.tsx (if they were moved inside by #4783 or similar).
  2. Upgrade to the findable-ui version containing fix: validate filter query params and surface errors inside error boundary (#898) #899 to pick up the filter param validation.
  3. Verify the three test cases render the error page without looping:
    • Malformed JSON: ?filter=%5B%7B%22categoryKey... (truncated)
    • Wrong shape: ?filter=[{"facetName":"bogus","terms":["invalid"]}]
    • Valid shape, invalid values: ?filter=[{"categoryKey":"bogus","value":["invalid"]}]

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions