Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After using submit, the URL parameter is repeated #4118

Closed
tingfeng-key opened this issue Sep 2, 2022 · 4 comments
Closed

After using submit, the URL parameter is repeated #4118

tingfeng-key opened this issue Sep 2, 2022 · 4 comments

Comments

@tingfeng-key
Copy link

tingfeng-key commented Sep 2, 2022

What version of Remix are you using?

1.7.0、1.6.8

Steps to Reproduce

code:

import { json } from "@remix-run/node";
import { useSubmit } from "@remix-run/react";
import { useState } from 'react';

export async function loader() {
  return json({});
}

export default function Index() {
  const submit = useSubmit();

  const [page, setPage] = useState(1);

  return (
    <button onClick={() => {
      submit({ "page": page.toString() }, { replace: true });
      setPage(page + 1);
    }}>clieck</button>
  );
}

Click the button more than once, and the page parameter in the URL will repeat.

Version 1.6.5 is normal

Expected Behavior

First click:http://127.0.0.1:3000/?index=&page=1
Second click:http://127.0.0.1:3000/?index=&page=2
Third Click:http://127.0.0.1:3000/?index=&page=3

Actual Behavior

First click:http://127.0.0.1:3000/?index=&page=1
Second click:http://127.0.0.1:3000/?index=&page=1&page=2
Third Click:http://127.0.0.1:3000/?index=&page=1&page=2&page=3

@abenhamdine
Copy link

related PR #4046 ?

@tingfeng-key
Copy link
Author

I think they are not the same problem.

@cliffordfajardo
Copy link
Contributor

cliffordfajardo commented Sep 4, 2022

I am also seeing this behavior in 1.7.0 and it seems to affect submission's using <Form> & the useSubmit.form from Remix
Legend: (works normally ✅ ) ------ (not working normally ❌ )

v1.6.7

v1.7.0

Video Reproduction

001-repeated-params.mp4

@chaance
Copy link
Collaborator

chaance commented Sep 8, 2022

I do believe #4046 addressed this. Confirmed that this is fixed in 1.7.1-pre.0. Stable release should be out shortly 👍

@chaance chaance closed this as completed Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants