Skip to content

Commit

Permalink
fix(build, memoization): removed it again
Browse files Browse the repository at this point in the history
  • Loading branch information
BowlingX committed Dec 5, 2019
1 parent 88933f0 commit c460622
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
"node": ">=8.9"
},
"dependencies": {
"query-string": "^6.9.0",
"memoize-one": "^5.1.1"
"query-string": "^6.9.0"
},
"peerDependencies": {
"history": "^4",
Expand Down
8 changes: 1 addition & 7 deletions src/lib/store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* tslint:disable:no-expression-statement readonly-array no-shadowed-variable */
import { History } from 'history'
import LocationState = History.LocationState
import memoizeOne from 'memoize-one'

import { stringify } from 'query-string'
import { createContext, useContext, useEffect, useMemo, useState } from 'react'
Expand Down Expand Up @@ -59,11 +58,6 @@ export const factoryParameters = <T = object>(
ns: string = DEFAULT_NAMESPACE
) => {
const flatConfig = flattenConfig(config)
const memoizedApplyFlatConfigToState = memoizeOne(
applyFlatConfigToState,
([, nextInitialQueries, nextNs], [, previousInitialQueries, previousNs]) =>
nextNs === previousNs && nextInitialQueries === previousInitialQueries
)
const useQuery = () => {
const [useStore, api] = useContext(StoreContext) as [
UseStore<StoreState<T>>,
Expand Down Expand Up @@ -109,7 +103,7 @@ export const factoryParameters = <T = object>(
// thisValues will be mutated by applyFlatConfigToState, that's why we init it with a copy of
// the initial state.
const thisValues = { ...defaultInitialValues }
const thisQuery = memoizedApplyFlatConfigToState(
const thisQuery = applyFlatConfigToState(
flatConfig,
initialQueries,
ns,
Expand Down

0 comments on commit c460622

Please sign in to comment.