mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-30 17:02:49 -05:00
Allow errored views to be reloaded
This commit is contained in:
@@ -23,7 +23,7 @@ Mousetrap.bind('ctrl+shift+i', () => {
|
||||
function Overlay({ views, streams, customStreams }) {
|
||||
const activeViews = views
|
||||
.map(({ state, context }) => State.from(state, context))
|
||||
.filter((s) => s.matches('displaying'))
|
||||
.filter((s) => s.matches('displaying') && !s.matches('displaying.error'))
|
||||
return (
|
||||
<div>
|
||||
{activeViews.map((viewState) => {
|
||||
|
||||
@@ -180,8 +180,7 @@ export default class StreamWindow extends EventEmitter {
|
||||
reloadView(viewIdx) {
|
||||
const view = this.views.find(
|
||||
(v) =>
|
||||
v.state.matches('displaying') &&
|
||||
v.state.context.pos.spaces.includes(viewIdx),
|
||||
v.state.context.pos && v.state.context.pos.spaces.includes(viewIdx),
|
||||
)
|
||||
if (view) {
|
||||
view.send('RELOAD')
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
import { Machine, assign } from 'xstate'
|
||||
|
||||
const savePosIfSameURL = {
|
||||
actions: assign({
|
||||
pos: (context, event) => event.pos,
|
||||
}),
|
||||
cond: 'urlUnchanged',
|
||||
}
|
||||
|
||||
const viewStateMachine = Machine(
|
||||
{
|
||||
id: 'view',
|
||||
@@ -31,7 +24,7 @@ const viewStateMachine = Machine(
|
||||
invoke: {
|
||||
src: 'clearView',
|
||||
onError: {
|
||||
target: '#view.error',
|
||||
target: '#view.displaying.error',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -43,7 +36,12 @@ const viewStateMachine = Machine(
|
||||
url: (context, event) => event.url,
|
||||
}),
|
||||
on: {
|
||||
DISPLAY: savePosIfSameURL,
|
||||
DISPLAY: {
|
||||
actions: assign({
|
||||
pos: (context, event) => event.pos,
|
||||
}),
|
||||
cond: 'urlUnchanged',
|
||||
},
|
||||
RELOAD: '.loading',
|
||||
},
|
||||
states: {
|
||||
@@ -57,7 +55,7 @@ const viewStateMachine = Machine(
|
||||
target: 'video',
|
||||
},
|
||||
onError: {
|
||||
target: '#view.error',
|
||||
target: '#view.displaying.error',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -71,7 +69,7 @@ const viewStateMachine = Machine(
|
||||
}),
|
||||
},
|
||||
onError: {
|
||||
target: '#view.error',
|
||||
target: '#view.displaying.error',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -103,12 +101,9 @@ const viewStateMachine = Machine(
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
error: {
|
||||
entry: 'logError',
|
||||
on: {
|
||||
DISPLAY: savePosIfSameURL,
|
||||
error: {
|
||||
entry: 'logError',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -164,7 +164,7 @@ function App({ wsEndpoint }) {
|
||||
url={url}
|
||||
onChangeSpace={handleSetView}
|
||||
spaceValue={streamId}
|
||||
isError={state.matches('error')}
|
||||
isError={state.matches('displaying.error')}
|
||||
isDisplaying={state.matches('displaying')}
|
||||
isListening={isListening}
|
||||
onSetListening={handleSetListening}
|
||||
|
||||
Reference in New Issue
Block a user