Skip to content

fix: don't submit default/empty filter fields on the issues board - #737

Open
smartcalsystems-sketch wants to merge 1 commit into
MergeFi:mainfrom
smartcalsystems-sketch:fix-filter-form-submits-defaults-701
Open

smartcalsystems-sketch wants to merge 1 commit into
MergeFi:mainfrom
smartcalsystems-sketch:fix-filter-form-submits-defaults-701

Conversation

@smartcalsystems-sketch

Copy link
Copy Markdown

Problem

The /issues GET form always submits every named field, including all/default selects and empty number inputs. buildIssuesHref deliberately omits defaults, but form submission bypasses it, so clicking "Apply filters" with everything left at its default produces ?difficulty=all&asset=all&minReward=&maxReward=&sort=default instead of the canonical bare /issues — a different, duplicate-content URL for the same unfiltered view.

Fix

Extracted the form into a new client component, IssuesFilterForm, that disables any field still at its default/empty value right before submit — disabled form fields aren't included in a submission, so the resulting URL matches what buildIssuesHref would produce. The page is still server-rendered with a plain GET form and works with JavaScript disabled exactly as before (per the existing design comment in page.tsx); this only changes behavior once JS is available to run the submit handler, per the issue's own suggested fix.

Testing

  • Added IssuesFilterForm.test.tsx (3 tests): confirms a submission with everything at default omits every field, confirms non-default values are still included, and confirms only the fields a visitor actually changed are sent.
  • Existing src/app/issues/page.test.tsx suite: 15/15 still passing after the extraction, zero regressions.
  • tsc --noEmit and eslint clean on all changed files.

Closes #701

…oses MergeFi#701)

The /issues GET form always submitted every named field, including
"all"/"default" selects and empty number inputs, producing URLs like
?difficulty=all&asset=all&minReward=&maxReward=&sort=default for the
same unfiltered view buildIssuesHref would represent as a bare /issues.

Extracted the form into a client component (IssuesFilterForm) that
disables any field still at its default/empty value right before
submit -- disabled fields aren't included in a form submission, so the
resulting URL matches the canonical one. The page still renders as a
plain GET form server-side and works with JavaScript disabled; this
only changes what happens once JS is available to run the handler.
@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

@smartcalsystems-sketch is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

The filter form submits default values, producing URLs like ?difficulty=all&asset=all&minReward=&maxReward=&sort=default

1 participant