Fix type action forcing

This commit is contained in:
tannerlinsley
2019-07-23 12:12:46 -06:00
parent fd64486286
commit 514fbabb88
2 changed files with 5 additions and 3 deletions

View File

@@ -1,9 +1,11 @@
const actions = {}
const types = new Set()
export { actions }
export { actions, types }
export const addActions = acts => {
Object.keys(acts).forEach(key => {
types.add(acts[key])
actions[key] = acts[key]
})
}

View File

@@ -1,6 +1,6 @@
import React from 'react'
//
import { actions } from '../actions'
import { types } from '../actions'
export const defaultState = {}
@@ -32,7 +32,7 @@ export const useTableState = (
const reducedSetState = React.useCallback(
(updater, type) => {
return setState(old => {
if (!actions[type]) {
if (!types.has(type)) {
console.info({
stateUpdaterFn: updater,
actionType: type,