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 e0d902d279
commit 248a1f456f
1 changed files with 3 additions and 1 deletions

View File

@ -85,7 +85,9 @@ export const getFrontendStore = () => {
screens: {
select: screenId => {
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
state.currentFrontEndType = FrontendTypes.SCREEN
state.currentAssetId = screen._id