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

Fields are not reactive when used inside SimpleFormIterator #8427

Closed
WiXSL opened this issue Nov 23, 2022 · 2 comments · Fixed by #8445
Closed

Fields are not reactive when used inside SimpleFormIterator #8427

WiXSL opened this issue Nov 23, 2022 · 2 comments · Fixed by #8445
Labels

Comments

@WiXSL
Copy link
Contributor

WiXSL commented Nov 23, 2022

Related to #8359

None of the possible solutions work correctly when using a Field inside a SimpleFormIterator.
I put together a Stackblitz (https://stackblitz.com/edit/github-stqpcj?file=src%2Fposts%2FPostEdit.tsx) to show what I mean.

It shows tree components:
1- Labeled + FunctionField. => It works but with a warning for not using getSource
2- Labeled + TextField passing source='url' and record={scopedFormData}. => It works but with a warning for not using getSource
3- Labeled + TextField with source=getSource('url'). => Shows the data but doesn't change when an input of the same source changes (merged in #8359)

Reproduction:
1- Edit the Post of id=1 and click in Miscellaneous Tab.
2- In the Backlinks ArrayInput, type into the URL input to see the results

@WiXSL WiXSL added the bug label Nov 23, 2022
@slax57
Copy link
Contributor

slax57 commented Nov 28, 2022

Thanks for this report.

I just tested solution 2 without passing the extra props, and it seems to be working too.
Can you confirm on your end?

If this is confirmed, then we should go for this solution, and maybe get rid of the warning (plus perhaps update the docs to explain that getSource is a useful helper but you loose reactivity when using it).

What do you think?

@WiXSL
Copy link
Contributor Author

WiXSL commented Nov 28, 2022

I agreee that removing th warning on solution two would be the way to go.
I'm pushing a PR shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants