Repository navigation
fix: don't submit default/empty filter fields on the issues board - #737
Open
smartcalsystems-sketch wants to merge 1 commit into
Open
smartcalsystems-sketch wants to merge 1 commit into
smartcalsystems-sketch wants to merge 1 commit into
Conversation
…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.
|
@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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
/issuesGET form always submits every named field, includingall/defaultselects and empty number inputs.buildIssuesHrefdeliberately 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=defaultinstead 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 whatbuildIssuesHrefwould 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 inpage.tsx); this only changes behavior once JS is available to run the submit handler, per the issue's own suggested fix.Testing
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.src/app/issues/page.test.tsxsuite: 15/15 still passing after the extraction, zero regressions.tsc --noEmitandeslintclean on all changed files.Closes #701