mirror of
https://github.com/strapi/strapi.git
synced 2026-01-07 12:45:45 +00:00
clean dynamic zone components create
This commit is contained in:
parent
02d467f933
commit
71e2c66a2c
@ -82,19 +82,21 @@ const createComponents = async (uid, data) => {
|
||||
throw new Error('Expected an array to create repeatable component');
|
||||
}
|
||||
|
||||
const createDynamicZoneComponents = async (value) => {
|
||||
const { id } = await createComponent(value.__component, value);
|
||||
return {
|
||||
id,
|
||||
__component: value.__component,
|
||||
__pivot: {
|
||||
field: attributeName,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
// MySQL/MariaDB can cause deadlocks here if concurrency higher than 1
|
||||
componentBody[attributeName] = await mapAsync(
|
||||
dynamiczoneValues,
|
||||
async (value) => {
|
||||
const { id } = await createComponent(value.__component, value);
|
||||
return {
|
||||
id,
|
||||
__component: value.__component,
|
||||
__pivot: {
|
||||
field: attributeName,
|
||||
},
|
||||
};
|
||||
},
|
||||
createDynamicZoneComponents,
|
||||
{ concurrency: isDialectMySQL() ? 1 : Infinity }
|
||||
);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user