Skip to content

[uui-core routing]: URL filter parsing fails for values containing percent sign (%) #3058

@YKamai

Description

@YKamai

Prerequisites (optional)

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Description (optional)

useTableState query parsing breaks when a filter value contains % (for example %%%).

In this case, filter state restored from URL becomes inconsistent: filter toggler may not show the entered value, and downstream code can receive malformed filter data (e.g. object with "0", "1", ... keys representing characters of serialized JSON).

The issue is reproducible on latest published @epam/uui-core and appears to be caused by double-decoding query values during parsing.

Steps to Reproduce

  1. Create a table using useTableState with a custom text filter.
  2. Enter %%% in the filter input.
  3. Observe filter state and resulting request payload.

Sample code (minimal usage pattern):

const { tableState, setTableState } = useTableState({
  filters: [
    {
      field: 'textFilter',
      title: 'Text Filter',
      type: 'custom',
      render: ({ value, onValueChange }) => (
        <TextInput value={value} onValueChange={onValueChange} />
      )
    }
  ]
});

Actual result

  • Filter toggler can lose entered value for % input (shows only filter name instead of FilterName: %%%).
  • URL-restored filter can become invalid for further edits/removal.
  • Downstream payload can become malformed (character-indexed object), for example: { "0": "{", "1": """, ... }

Root cause in published bundle appears to be:

  • JSON.parse(decodeURIComponent(value)) in query parsing paths.
  • URLSearchParams already returns decoded values; extra decodeURIComponent can fail for raw % content (e.g. %%%), causing fallback to raw string and corrupted state flow.

Expected result

  • Filter values containing % should be serialized/deserialized via URL without corruption.
  • Toggler should consistently show entered value.
  • Clearing/updating such filters should work normally.
  • Parsed query state should remain valid object shape.

Environment

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • UUI version: @epam/uui-core@6.4.3 (also reproducible on 6.3.1)
  • Browser name: Chrome
  • Operating System: macOS 26.3 Tahoe

Notes

I verified this behavior on latest published version and have a local patch ready. I can open a PR if this approach is accepted.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions