1
0
Fork 0
mirror of synced 2024-07-01 20:41:03 +12:00

Remove debug logs and add comments

This commit is contained in:
Andrew Kingston 2022-07-15 09:14:54 +01:00
parent f00d441f8e
commit b82c57fac8

View file

@ -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 })