Creating new entity with customFields, leads to migration failure #3274
Labels
contributions welcome
P4: low
Non-critical, workarounds exist
type: bug 🐛
Something isn't working
@vendure/core
Describe the bug
If you create a new entity that has customFields support, it will fail migration if you add the customFields right away in the plugin configuration. Kind of an edge case, since the entity doesn't exist yet before the migration.
Why use
customFields
in the first place on a custom entity? It seems like a flexible way to have a generic interface with good ui support for an entity that in my case is supposed to be very extensible in nature.To Reproduce
Steps to reproduce the behavior:
Cannot read properties of undefined (reading 'push')
Expected behavior
Ideally, this should be handled gracefully.
Environment (please complete the following information):
Workaround
I thought the workaround would be to escape the customFields creation when you run the first migration creation command. Run pending migrations, then run the customFields migration as a second migration creation.
Unfortunately, it seems that Vendure doesn't include custom entities in their list of "customFields entities" during the start up process at the correct moment. So, the new entity doesn't get added to the config.customFields object before it hits the
configation
function. I haven't tested this yet against 3.1The text was updated successfully, but these errors were encountered: