mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-30 08:52:49 -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'
|
import { Machine, assign } from 'xstate'
|
||||||
|
|
||||||
|
const savePosIfSameURL = {
|
||||||
|
actions: assign({
|
||||||
|
pos: (context, event) => event.pos,
|
||||||
|
}),
|
||||||
|
cond: 'urlUnchanged',
|
||||||
|
}
|
||||||
|
|
||||||
const viewStateMachine = Machine(
|
const viewStateMachine = Machine(
|
||||||
{
|
{
|
||||||
id: 'view',
|
id: 'view',
|
||||||
@@ -36,12 +43,7 @@ const viewStateMachine = Machine(
|
|||||||
url: (context, event) => event.url,
|
url: (context, event) => event.url,
|
||||||
}),
|
}),
|
||||||
on: {
|
on: {
|
||||||
DISPLAY: {
|
DISPLAY: savePosIfSameURL,
|
||||||
actions: assign({
|
|
||||||
pos: (context, event) => event.pos,
|
|
||||||
}),
|
|
||||||
cond: 'urlUnchanged',
|
|
||||||
},
|
|
||||||
RELOAD: '.loading',
|
RELOAD: '.loading',
|
||||||
},
|
},
|
||||||
states: {
|
states: {
|
||||||
@@ -105,6 +107,9 @@ const viewStateMachine = Machine(
|
|||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
entry: 'logError',
|
entry: 'logError',
|
||||||
|
on: {
|
||||||
|
DISPLAY: savePosIfSameURL,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user