1
0
Fork 0
mirror of synced 2024-08-26 23:42:06 +12:00

Reload app metadata when adding custom components

This commit is contained in:
Andrew Kingston 2022-08-11 17:05:04 +01:00
parent 846b58364f
commit 4e916d2812

View file

@ -227,9 +227,18 @@ export const getFrontendStore = () => {
})
},
save: async screen => {
const state = get(store)
const creatingNewScreen = screen._id === undefined
const savedScreen = await API.saveScreen(screen)
const routesResponse = await API.fetchAppRoutes()
let usedPlugins = state.usedPlugins
// If plugins changed we need to fetch the latest app metadata
if (savedScreen.pluginAdded) {
const { application } = await API.fetchAppPackage(state.appId)
usedPlugins = application.usedPlugins || []
}
store.update(state => {
// Update screen object
const idx = state.screens.findIndex(x => x._id === savedScreen._id)
@ -248,6 +257,9 @@ export const getFrontendStore = () => {
// Update routes
state.routes = routesResponse.routes
// Update used plugins
state.usedPlugins = usedPlugins
return state
})
return savedScreen