mirror of
https://github.com/gosticks/react-table.git
synced 2026-07-04 03:10:01 +00:00
Fix type action forcing
This commit is contained in:
@@ -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]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user