Skip to content

v7 Feedback & Ideas #1252

@Grsmto

Description

@Grsmto

Hi,
First, I'm trying v7, it's awesome to work with Hooks! Trying it for the first time so my comments might be wrong.

Describe the bug
This are more of an architecture comment than a bug:
If you disable useExpanded hook, the table breaks.
I know in userland you can't disable this hook but the fact that this happens, (edit: actually you can) probably demonstrates wrong app design: I figured out this is happening because you're building initial state within the useExpanded hook (row.cells = ...).

Expected behavior
I think that adding or removing hooks should not break the entire component. Hooks should be encapsulated.

Codesandbox!
https://codesandbox.io/s/nk9rmym6m4

Solution
That initial state logic could be within useTable itself (tested and works fine).
I can provide a PR if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions