When /states/bad_view is selected - fall back to default view. (#1002)

This commit is contained in:
Andrey 2018-03-17 00:38:27 +02:00 committed by Paulus Schoutsen
parent 860860099e
commit b03c361198

View File

@ -183,7 +183,7 @@
currentView: { currentView: {
type: String, type: String,
computed: '_computeCurrentView(routeMatch, routeData)', computed: '_computeCurrentView(hass, routeMatch, routeData)',
}, },
views: { views: {
@ -288,8 +288,12 @@
} }
} }
_computeCurrentView(routeMatch, routeData) { _computeCurrentView(hass, routeMatch, routeData) {
return routeMatch ? routeData.view : ''; if (!routeMatch) return '';
if (!hass.states[routeData.view] || !hass.states[routeData.view].attributes.view) {
return '';
}
return routeData.view;
} }
computeTitle(views, defaultView, locationName) { computeTitle(views, defaultView, locationName) {