Remove debug logs and add comments
This commit is contained in:
parent
f00d441f8e
commit
b82c57fac8
|
@ -61,6 +61,12 @@ const INITIAL_FRONTEND_STATE = {
|
|||
export const getFrontendStore = () => {
|
||||
const store = writable({ ...INITIAL_FRONTEND_STATE })
|
||||
|
||||
// This is a fake implementation of a "patch" API endpoint to try and prevent
|
||||
// 409s. All screen doc mutations (aside from creation) use this function,
|
||||
// which queues up invocations sequentially and ensures pending mutations are
|
||||
// always applied to the most up-to-date doc revision.
|
||||
// This is slightly better than just a traditional "patch" endpoint and this
|
||||
// supports deeply mutating the current doc rather than just appending data.
|
||||
const sequentialScreenPatch = Utils.sequential(async (patchFn, screenId) => {
|
||||
const state = get(store)
|
||||
const screen = state.screens.find(screen => screen._id === screenId)
|
||||
|
@ -75,10 +81,6 @@ export const getFrontendStore = () => {
|
|||
return await store.actions.screens.save(clone)
|
||||
})
|
||||
|
||||
store.subscribe(() => {
|
||||
console.log("new state")
|
||||
})
|
||||
|
||||
store.actions = {
|
||||
reset: () => {
|
||||
store.set({ ...INITIAL_FRONTEND_STATE })
|
||||
|
|
Loading…
Reference in New Issue