Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//
// Use getInitialProps as a step in the lifecycle when
// we can initialize our store
//
const isServer = typeof window === 'undefined'
const store = initializeStore(isServer)
//
// Check whether the page being rendered by the App has a
// static getInitialProps method and if so call it
//
let pageProps = {}
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx)
}
return {
initialState: getSnapshot(store),
isServer,
pageProps,
}
}
test("it should be able to move boxes - 1", () => {
var box = Box.create({ x: 100, y: 100, id: "1", name: "test" })
box.move(23, 10)
expect(getSnapshot(box)).toMatchSnapshot()
box.move(22, -13)
expect(getSnapshot(box)).toMatchSnapshot()
})
onPointerUp={() => {
try {
window.localStorage.setItem(
'__GRADIENTLAB_STORE__',
JSON.stringify(getSnapshot(store))
)
} catch (err) {
console.error(err)
}
toast('Saved', {
position: 'bottom-right'
})
}}
>
const handleHistoryChangeListener = (changes, namespace) => {
if (namespace === 'local') {
const change = changes.history;
if (change) {
const history = change.newValue;
if (!_isEqual(history, getSnapshot(self.history))) {
self.assign({history});
}
}
}
};
() => getSnapshot(self),
json => {
function requestValues(command: any) {
const trackedNode = trackedNodes[command.mstNodeName || "default"]
const atPath: string = (command && command.payload && command.payload.path) || []
if (trackedNode && trackedNode.node && atPath) {
const state = getSnapshot(trackedNode.node)
if (isNilOrEmpty(atPath)) {
reactotron.stateValuesResponse(null, state)
} else {
reactotron.stateValuesResponse(atPath, dotPath(atPath, state))
}
}
}
save: flow(function*() {
yield save(key, filterSnapshotKeys(getSnapshot(self)))
}),
return folder.load(view.routeParams.get('uid') as string).then(res => {
this.formSnapshot = getSnapshot(folder);
this.dashboard = res.dashboard;
view.updatePathAndQuery(`${res.meta.url}/settings`, {}, {});
return nav.initFolderNav(toJS(folder.folder), 'manage-folder-settings');
});
}
static async getInitialProps({ Component, router, ctx }) {
let pageProps = {};
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx);
}
return { pageProps, initialState: getSnapshot(appStoreInstance.get()) };
}
return limitOne(() => {
const sections = getSnapshot(self.sections);
return promisifyApi('chrome.storage.local.set')({explorerSections: sections});
});
},