Fix empty screen list when deleting a table backing an autoscreen which is currently selected

This commit is contained in:
Andrew Kingston 2020-12-09 16:01:16 +00:00
parent 52dd9760c5
commit ce917b5005
1 changed files with 3 additions and 1 deletions

View File

@ -85,7 +85,9 @@ export const getFrontendStore = () => {
screens: { screens: {
select: screenId => { select: screenId => {
store.update(state => { store.update(state => {
const screen = get(allScreens).find(screen => screen._id === screenId) let screens = get(allScreens)
let screen =
screens.find(screen => screen._id === screenId) || screens[0]
if (!screen) return state if (!screen) return state
state.currentFrontEndType = FrontendTypes.SCREEN state.currentFrontEndType = FrontendTypes.SCREEN
state.currentAssetId = screen._id state.currentAssetId = screen._id