on master help sign in
fix: use empty object as initial state
7da2fb2Matt Condon (shrugs)
src/bridge/store/pointCache.js+4−5
@@ -1,10 +1,9 @@
1import React, { createContext, forwardRef, useContext, useState } from 'react';
1import React, { createContext, forwardRef, useContext, useState } from 'react';
2−import Maybe from 'folktale/maybe';
3
2
4export const PointCacheContext = createContext(null);
3export const PointCacheContext = createContext(null);
5
4
6−function _usePointCache(initialPointCache = Maybe.Nothing()) {
5+function _usePointCache() {
7− const [pointCache, _setPointCache] = useState(initialPointCache);
6+ const [pointCache, _setPointCache] = useState({});
8
7
9 const addToPointCache = entry =>
8 const addToPointCache = entry =>
10 _setPointCache(cache => ({ ...cache, entry }));
9 _setPointCache(cache => ({ ...cache, entry }));
@@ -15,8 +14,8 @@ function _usePointCache(initialPointCache = Maybe.Nothing()) {
15 };
14 };
16}
15}
17
16
18−export function PointCacheProvider({ initialPointCache, children }) {
17+export function PointCacheProvider({ children }) {
19− const pointCache = _usePointCache(initialPointCache);
18+ const pointCache = _usePointCache();
20
19
21 return (
20 return (
22 <PointCacheContext.Provider value={pointCache}>
21 <PointCacheContext.Provider value={pointCache}>