on master help sign in
fix: use empty object as initial state
commit7da2fb2f9fe43f66d04f55f8090e7dcd4be56a9a authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateMon 17 Jun 2019, 11:49 (7 years ago) parenta02f39a
1 file changed+4−5
src/bridge/store/pointCache.js+4−5
src/bridge/store/pointCache.js+4−5
@@ -1,10 +1,9 @@
11import React, { createContext, forwardRef, useContext, useState } from 'react';
2−import Maybe from 'folktale/maybe';
32
43export const PointCacheContext = createContext(null);
54
6−function _usePointCache(initialPointCache = Maybe.Nothing()) {
7− const [pointCache, _setPointCache] = useState(initialPointCache);
5+function _usePointCache() {
6+ const [pointCache, _setPointCache] = useState({});
87
98 const addToPointCache = entry =>
109 _setPointCache(cache => ({ ...cache, entry }));
@@ -15,8 +14,8 @@ function _usePointCache(initialPointCache = Maybe.Nothing()) {
1514 };
1615}
1716
18−export function PointCacheProvider({ initialPointCache, children }) {
19− const pointCache = _usePointCache(initialPointCache);
17+export function PointCacheProvider({ children }) {
18+ const pointCache = _usePointCache();
2019
2120 return (
2221 <PointCacheContext.Provider value={pointCache}>