Skip to content

Allow decorators prop to change identity, but not array contents, without running on every render#893

Merged
erikras merged 1 commit into
final-form:mainfrom
bobbyrenwick:codespace-b7c7
Jul 23, 2021
Merged

Allow decorators prop to change identity, but not array contents, without running on every render#893
erikras merged 1 commit into
final-form:mainfrom
bobbyrenwick:codespace-b7c7

Conversation

@bobbyrenwick

@bobbyrenwick bobbyrenwick commented Feb 4, 2021

Copy link
Copy Markdown
Contributor

I am running into an issue of infinite loops when upgrading from pre-hooks code to hooks based forms.

This allows you to have something like the following where the decorators will change identity on every render, without causing that decorator to be unsubscribed and re-subscribed on every render, which seems like it could be unintentional.

I'm unsure how to write a test for this but would appreciate any guidance!

const CustomForm = () => {
    return <Form decorators={[decorator1, decorator2]} />
}

Tests are failing for something unrelated? [test] Cannot find module '@babel/plugin-transform-react-jsx-source'

@bobbyrenwick bobbyrenwick changed the title Allow decorators prop to change identity, but not array contents, without running ono every render Feb 4, 2021
@erikras erikras merged commit 8389951 into final-form:main Jul 23, 2021
@erikras

erikras commented Sep 29, 2021

Copy link
Copy Markdown
Member

Published in v6.5.4.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants