Closed sdgroot closed 1 year ago
Investigating. But all operations are triggered by Strapi logic. Try to set plugin on the first place of config/plugins.js
file like:
{
navigation: {
enabled: true,
},
// ...
}
Similar issue #345
Investigating. But all operations are triggered by Strapi logic. Try to set plugin on the first place of
config/plugins.js
file like:{ navigation: { enabled: true, }, // ... }
Thanks for your quick reply. The navigation plugin is the only plugin listed in this file. Please find the contents of plugins.js attached.
Any update on this?
Yes, this is still an issue.
Incase anyone needs a temporary fix you can add "patch-package" and apply patch https://gist.github.com/loevstroem/11f1ed30f8c676dff2ef2df42046401b
@loevstroem may I ask you to create a PR with fix based on your snippet?
There is more wrong at the navigationSetupStrategy. Its still trying to insert navigations that already exists other then the default locale. Trying to debug it now, thanks for pointing out the locaiton @loevstroem.
@loevstroem may I ask you to create a PR with fix based on your snippet?
Absolutely.. Will submit later today.
There is more wrong at the navigationSetupStrategy. Its still trying to insert navigations that already exists other then the default locale. Trying to debug it now, thanks for pointing out the locaiton @loevstroem.
It seems like a conditionrace in Strapi trying to insert the locales at the same time. The patch should fix it. If its the correct solution @cyp3rius should know 😄
Tried your patch but it still fails at lline 64. If i add a condition in the CreateNavigation function, where i check if the slug already exists and update instead of creation it works. But its not the prettiest fix. If someone would help me beautify the code.
const createNavigation = ({ strapi, payload, populate }) => {
const exists = strapi.query("plugin::navigation.navigation").findOne({
where: {
slug: payload.slug,
},
})
if (!exists) {
return strapi.query("plugin::navigation.navigation").create({
data: {
...payload,
},
populate,
});
}
return strapi.query("plugin::navigation.navigation").update({
data: {
...payload,
},
populate,
where: {
slug: payload.slug,
},
});
}
Maybe something like that?
const createNavigation = async ({ strapi, payload, populate }) => {
const where = {
slug: payload.slug,
};
const data = { ...payload };
const exists = await strapi.query("plugin::navigation.navigation").findOne({ where });
if (!exists) {
return strapi.query("plugin::navigation.navigation").create({
data,
populate,
});
}
return strapi.query("plugin::navigation.navigation").update({
data,
populate,
where,
});
}
Fixed in version v2.2.15
We're currently encountering a critical issue that prevents Strapi from starting at all, either with or without develop mode. We've enabled i18n in Strapi. This is the error that we're getting:
I'd also like to know why these queries are executed on Strapi startup in the first place? Is this something that the plugin does, or is this executed by Strapi? Even when all
navigations_
tables are empty there seems to be data inserted into these tables when Strapi starts.Additional info: strapi-plugin-navigation v2.2.9 Strapi v4.11.0 (also fails in v4.10.x) MySQL v8.0.30 yarn v1.22.19 npm v9.7.1