Skip to content

benchmark URL state encoding throws for non-Latin1 values #65

Description

@dumanoglu1

Summary

The benchmark URL-state hook stores state with btoa(JSON.stringify(newValue)). Browser btoa() accepts only Latin1/binary strings, so a filter value containing non-Latin1 text throws before the hook can update state or the URL.

Code path

app/benchmark/utils/useSearchParamsState.ts:

newParams.set(paramName, btoa(JSON.stringify(newValue)));

The read path has a try/catch around atob/JSON.parse, but the write path does not handle the Unicode encoding case.

Repro

btoa(JSON.stringify({ label: 'Ethereum ? Base' }))
// throws: InvalidCharacterError / Invalid character

Expected behavior

The hook should encode URL state through a UTF-8 safe path before base64 encoding, and decode it symmetrically, so future benchmark labels or filter values containing normal Unicode punctuation do not crash the setter.

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