Skip to content

Commit

Permalink
fix(core): remove duplicateds tasks plugins (#6134)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin authored Mar 27, 2024
1 parent 3e5b8d6 commit a0fce46
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/sanity/src/core/config/flattenConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ export const flattenConfig = (
flattenConfig(plugin, [...path, currentConfig.name]),
)

const resolved = [...allPlugins, rootConfig]
// We need to check if the task plugin was added, it could be inserted more than once, in that case we only want to add it once.
const tasksPlugin = allPlugins.find((plugin) => plugin.config.name === 'sanity/tasks')

const resolved = [
...allPlugins.filter((plugin) => plugin.config.name !== 'sanity/tasks'),
rootConfig,
]

if (tasksPlugin) {
resolved.push(tasksPlugin)
}
return resolved
}

0 comments on commit a0fce46

Please sign in to comment.