mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-25 22:52:48 -05:00
Don't reload errored views with unchanged url when updating views
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
import { Machine, assign } from 'xstate'
|
||||
|
||||
const savePosIfSameURL = {
|
||||
actions: assign({
|
||||
pos: (context, event) => event.pos,
|
||||
}),
|
||||
cond: 'urlUnchanged',
|
||||
}
|
||||
|
||||
const viewStateMachine = Machine(
|
||||
{
|
||||
id: 'view',
|
||||
@@ -36,12 +43,7 @@ const viewStateMachine = Machine(
|
||||
url: (context, event) => event.url,
|
||||
}),
|
||||
on: {
|
||||
DISPLAY: {
|
||||
actions: assign({
|
||||
pos: (context, event) => event.pos,
|
||||
}),
|
||||
cond: 'urlUnchanged',
|
||||
},
|
||||
DISPLAY: savePosIfSameURL,
|
||||
RELOAD: '.loading',
|
||||
},
|
||||
states: {
|
||||
@@ -105,6 +107,9 @@ const viewStateMachine = Machine(
|
||||
},
|
||||
error: {
|
||||
entry: 'logError',
|
||||
on: {
|
||||
DISPLAY: savePosIfSameURL,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user