You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am implementing Settings page which handles configuring sub-domains for a tenant.
It uses payload/components/forms/Form to render domains array field and submit the updated data.
I used buildInitialState function to convert the initial data(which was fetched from db) to form state.
The form didn't show the initial rows when initialState was generated by the payload's buildInitialState, so I had to implement my own one to perform the conversion.
I noticed that Form component treats Array or Block field states in a different way from this code:
But buildInitialState was not treating those fields differently.
To Reproduce
I was implementing Settings page which handles configuring sub-domains for a tenant.
It uses payload/components/forms/Form to render domains array field and submit the updated data.
I used buildInitialState function to convert the initial data(which was from db) to form state.
import buildInitialState from 'payload/dist/admin/components/forms/Form/buildInitialState';
The field configuration and initial data looks like this:
Link to reproduction
No response
Describe the Bug
I am implementing Settings page which handles configuring sub-domains for a tenant.
It uses
payload/components/forms/Form
to render domains array field and submit the updated data.I used
buildInitialState
function to convert the initial data(which was fetched from db) to form state.The form didn't show the initial rows when initialState was generated by the payload's buildInitialState, so I had to implement my own one to perform the conversion.
I noticed that Form component treats Array or Block field states in a different way from this code:
![image](https://private-user-images.githubusercontent.com/154989107/338665954-7406b8dd-93f2-4eb7-9bb6-33d6d13465d7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1OTE0OTYsIm5iZiI6MTcyMjU5MTE5NiwicGF0aCI6Ii8xNTQ5ODkxMDcvMzM4NjY1OTU0LTc0MDZiOGRkLTkzZjItNGViNy05YmI2LTMzZDZkMTM0NjVkNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwMlQwOTMzMTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZTMxYmIyZGUzM2Y5ZmFiZDIxMmE4NTJiZTIxZjQ5MmRiOGNmYjI2ZTM3ODRiODNiZDhjMjc2OWIwYjA5NTQ3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.rB0xptb7YQF2SzLNSqoSur4g35Jb36AnvKKGthIZgeY)
But
buildInitialState
was not treating those fields differently.To Reproduce
I was implementing Settings page which handles configuring sub-domains for a tenant.
It uses
payload/components/forms/Form
to render domains array field and submit the updated data.I used
buildInitialState
function to convert the initial data(which was from db) to form state.The field configuration and initial data looks like this:
And the return value of the react component looks like this:
The expected value of
initialState
is like this:While
initialState
generated bybuildInitialState
is:The form didn't show the initial rows when initialState was generated by the payload's buildInitialState, so I implemented my own one.
Payload Version
2.19.3
Adapters and Plugins
No response
The text was updated successfully, but these errors were encountered: