8000 defaultStickyColumnName prop not working · Issue #19 · githubocto/flat-ui · GitHub
[go: up one dir, main page]

Skip to content
defaultStickyColumnName prop not working #19
Closed
@paulshen

Description

@paulshen

Thanks for this awesome library! I noticed that defaultStickyColumnName was not being respected when testing it out.

Here's a codesandbox repro https://codesandbox.io/s/dazzling-cray-bjmjs

It seems like columnNames is updated after handleStickyColumnNameChange

React.useEffect(() => {
if (props.defaultStickyColumnName)
handleStickyColumnNameChange(props.defaultStickyColumnName);
}, [props.defaultStickyColumnName, props.data]);

React.useEffect(updateColumnNames, [props.data, stickyColumnName]);

which causes the issue in this logic

flat-ui/src/store.ts

Lines 86 to 90 in 07b88ec

handleStickyColumnNameChange: (columnName) =>
set((draft) => {
if (!draft.columnNames.includes(columnName)) return;
draft.stickyColumnName = columnName;
}),

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

      0