-
Notifications
You must be signed in to change notification settings - Fork 21
fix(admin-ui): fix admin-ui build error #2417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
18c6457
05677fc
a279c5d
48b032e
d58531b
066841c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,26 @@ | ||
| import plugins from '../plugins.config.json' | ||
| import reducerRegistry from 'Redux/reducers/ReducerRegistry' | ||
|
|
||
| function process() { | ||
| async function process() { | ||
| const metadataFilePath = plugins.map((item) => item.metadataFile) | ||
| let pluginReducers = [] | ||
| metadataFilePath.forEach(async (path) => { | ||
| pluginReducers = await [...pluginReducers, ...require(`${path}`).default.reducers] | ||
|
|
||
| pluginReducers.forEach((element) => { | ||
| reducerRegistry.register(element.name, element.reducer) | ||
| }) | ||
| }) | ||
| for (const path of metadataFilePath) { | ||
| const pluginName = path?.match(/\.\/([^/]+)\/plugin-metadata/)?.[1] | ||
| if (pluginName) { | ||
| const metadata = await import( | ||
| /* webpackChunkName: "plugin-[request]" */ | ||
| /* webpackMode: "lazy" */ | ||
| /* webpackExclude: /\.test\.(js|jsx|ts|tsx)$/ */ | ||
| `./${pluginName}/plugin-metadata` | ||
| ) | ||
| const reducers = metadata.default.reducers || [] | ||
| pluginReducers = [...pluginReducers, ...reducers] | ||
|
|
||
| reducers.forEach((element) => { | ||
| reducerRegistry.register(element.name, element.reducer) | ||
| }) | ||
| } | ||
| } | ||
|
Comment on lines
+8
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bring back the fallback import. Same concern as in the sagas resolver: without importing 🤖 Prompt for AI Agents |
||
| } | ||
| export default process | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,31 @@ import plugins from '../plugins.config.json' | |
|
|
||
| //get all metadata path | ||
|
|
||
| function process() { | ||
| async function process() { | ||
| let pluginSagas = [] | ||
| plugins | ||
| .map((item) => item.metadataFile) | ||
| .forEach((path) => { | ||
| pluginSagas = [...pluginSagas, ...require(`${path}`).default.sagas] | ||
| }) | ||
|
|
||
| const pluginPromises = plugins.map(async (item) => { | ||
| const path = item.metadataFile | ||
| const pluginName = path?.match(/\.\/([^/]+)\/plugin-metadata/)?.[1] | ||
| if (pluginName) { | ||
| const metadata = await import( | ||
| /* webpackChunkName: "plugin-[request]" */ | ||
| /* webpackMode: "lazy" */ | ||
| /* webpackExclude: /\.test\.(js|jsx|ts|tsx)$/ */ | ||
| `./${pluginName}/plugin-metadata` | ||
| ) | ||
| return metadata.default.sagas || [] | ||
| } | ||
| return [] | ||
| }) | ||
|
Comment on lines
+8
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restore the metadata fallback. Previously we supported plugin entries whose 🤖 Prompt for AI Agents |
||
|
|
||
| const results = await Promise.allSettled(pluginPromises) | ||
| results.forEach((result) => { | ||
| if (result.status === 'fulfilled') { | ||
| pluginSagas = [...pluginSagas, ...result.value] | ||
| } | ||
| }) | ||
|
|
||
| return pluginSagas | ||
| } | ||
| export default process | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return the reducer list.
process()now resolves toundefined, but the rest of the codebase still expects an array of plugin reducers. Even in this file we keep buildingpluginReducers, so this looks accidental. Addreturn pluginReducersat the end (after the loop) so callers aren’t broken.async function process() { const metadataFilePath = plugins.map((item) => item.metadataFile) let pluginReducers = [] for (const path of metadataFilePath) { const pluginName = path?.match(/\.\/([^/]+)\/plugin-metadata/)?.[1] if (pluginName) { const metadata = await import( /* webpackChunkName: "plugin-[request]" */ /* webpackMode: "lazy" */ /* webpackExclude: /\.test\.(js|jsx|ts|tsx)$/ */ `./${pluginName}/plugin-metadata` ) const reducers = metadata.default.reducers || [] pluginReducers = [...pluginReducers, ...reducers] reducers.forEach((element) => { reducerRegistry.register(element.name, element.reducer) }) } } + return pluginReducers }📝 Committable suggestion
🤖 Prompt for AI Agents