table icon indicating copy to clipboard operation
table copied to clipboard

[v8] dot in accessorKey crashes the table

Open oeddyo opened this issue 2 years ago • 0 comments

Describe the bug

looks like when I try to upgrade from 8.2.3 -> 8.5.11 it crashes my app and I found out through a test case. When accessor key has dot, it crashes in 8.5.11

Might due to recent change though I'm not 100% sure

commit f7be4cfb25eff51a8438346ffbb0be039bc1be2e
Author: Tanner Linsley <[email protected]>
Date:   Wed Jul 20 09:29:05 2022 -0600

    feat: column helper utility, deep accessorKey support (#4185)

    * feat: column helper utility, deep accessorKey support

    * Update main.tsx

    * fix: export column def union types

diff --git a/packages/table-core/src/core/column.ts b/packages/table-core/src/core/column.ts
--- a/packages/table-core/src/core/column.ts
+++ b/packages/table-core/src/core/column.ts
@@ -98,1 +94,1 @@
-    resolvedColumnDef.accessorKey ??
+    (accessorKey ? accessorKey.replace('.', '_') : undefined) ??

Your minimal, reproducible example

https://codesandbox.io/s/quizzical-sun-4zm023?file=/src/main.tsx

Steps to reproduce

  1. create a simple table
  2. give one of the column name "a.b"
  3. use accessorkey a.b

Expected behavior

it should show a.b in header instead it crashes the table

How often does this bug happen?

No response

Screenshots or Videos

No response

Platform

sandbox mac os v8.5.11

react-table version

v8.5.11

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

oeddyo avatar Aug 18 '22 05:08 oeddyo