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

fixed AutoForm not updating upon changes to findBy objects #644

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

MillanWangGadget
Copy link
Contributor

const X = () => {
  const [useFindBy1, setUseFindBy1] = useState(true);
  return (
    <>
      <button onClick={() => setUseFindBy1(!useFindBy1)}>Toggle Find By</button>
      <PolarisAutoForm action={api.widget.upsert} findBy={{ id: useFindBy1 ? "1" : "999" }}></PolarisAutoForm>
    </>
  );
};
  • UPDATE
    • Given something like the above component, we previously did not re-render the component upon dynamically changing the findBy object.
    • This was the result of the AutoForm key containing [Object object] for the find by value. Dynamic changes were lost to the simple toString
    • Now, the key is based on a JSON.stringify of the findBy object/string

@MillanWangGadget MillanWangGadget merged commit 41ab357 into main Sep 17, 2024
9 checks passed
@MillanWangGadget MillanWangGadget deleted the mill/fixAutoformFindByObjectKey branch September 17, 2024 19:15
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.

3 participants