Skip to content

Commit

Permalink
fix: 可以自定义勾选表头时,cacheWidth失效
Browse files Browse the repository at this point in the history
  • Loading branch information
LycheeWangWeida committed May 18, 2023
1 parent 2d9d6e4 commit 439a4d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/useAntdResizableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ function useAntdResizableHeader<ColumnType extends ColumnOriginType<ColumnType>>

const [triggerRender, forceRender] = useReducer((s) => s + 1, 0)

let kvMap: Map<string | number, CacheType>

const resetColumns = useMemoizedFn(() => {
widthCache.current = new Map()
kvMap = new Map()
widthCache.current = kvMap
resetLocalColumns()
})

Expand All @@ -104,7 +107,7 @@ function useAntdResizableHeader<ColumnType extends ColumnOriginType<ColumnType>>
if (width) {
setResizableColumns((t) => {
const nextColumns = depthFirstSearch(t, (col) => col[GETKEY] === id && !!col.width, width)
const kvMap = new Map<string | number, CacheType>()
kvMap = kvMap || new Map<string | number, CacheType>()
function dig(cols: ColumnType[]) {
cols.forEach((col, i) => {
const key = col[GETKEY]
Expand Down

0 comments on commit 439a4d6

Please sign in to comment.