Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options don't update when lit TableController update. #5831

Open
Lookwe69 opened this issue Dec 11, 2024 · 0 comments
Open

Options don't update when lit TableController update. #5831

Lookwe69 opened this issue Dec 11, 2024 · 0 comments

Comments

@Lookwe69
Copy link

Lookwe69 commented Dec 11, 2024

When the options in TableController.table changes, they are not used => previous options are kept.

I look in the code. I think it because '...options' is missing when we setOptions on tableInstance.

Current code :

this.tableInstance.setOptions(prev => ({
      ...prev,
      state: { ...this._tableState, ...options.state },
      onStateChange: (updater: any) => {
        this._tableState = updater(this._tableState)
        this.host.requestUpdate()
        options.onStateChange?.(updater)
      },
    }))
`

Fix code :

`js
this.tableInstance.setOptions(prev => ({
      ...prev,
      ...options,
      state: { ...this._tableState, ...options.state },
      onStateChange: (updater: any) => {
        this._tableState = updater(this._tableState)
        this.host.requestUpdate()
        options.onStateChange?.(updater)
      },
    }))
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant