svelte-table: controlled expanded and pagination state resets straight after every change
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- typescript
- Domaine
- frontend
Piste de recherche
Read the Svelte adapter’s options store in packages/svelte-table/src/reactivity.svelte.ts and the options sync effect in packages/svelte-table/src/createTable.svelte.ts, then trace how packages/table-core/src/core/row-models/createCoreRowModel.ts memoizes data and triggers auto-resets. Reproduce with the linked standalone example and check controlled expansion, pagination, and row.original identity. Done means controlled state persists across changes and unchanged caller data retains its identity.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
TanStack Table version
svelte-table 9.3.1 (and table-core 9.3.1). First seen on 9.2.4.
Framework/Library version
svelte 5.57.0
Describe the bug and the steps to reproduce it
When expanded or pagination is controlled through state and on*Change, and with a plain array (constant/$derived value/TanStack Query result) for data, row.toggleExpanded() and table.nextPage() dont do anything. The table applies the change and then resets the slice to its initial value, on every click. With data held in $state the bug doesn't show, because Svelte keeps the existing proxy.
The Svelte adapter's options store is a deep $state (reactivity.svelte.ts#L35). On each options sync, the $effect.pre in createTable (createTable.svelte.ts#L87-L102) writes a new options object that holds the caller's raw data array, and $state wraps that array in a new proxy each time. So table.options.data gets a new identity on every sync, even though data itself hasn't changed. The core row model memoizes on table.options.data and runs the auto-resets whenever it recomputes (createCoreRowModel.ts#L31-L38). Changing a controlled slice re-runs the sync, so every change undoes itself.
#6374 is this bug for pagination. It was closed with autoResetPageIndex: false as the workaround; autoResetExpanded: false works the same way for expansion. Both also turn off the reset for genuine data changes. The same proxying means row.original is a Svelte proxy, not the object the caller passed in.
The three tests in the standalone repro fail on 9.2.4, 9.2.6 and 9.3.1 every run:
https://github.com/NickSpag/svelte-table-controlled-state-repro
Steps:
- Render
ControlledExpanded.svelte. - Click "Ada: closed". It stays closed:
onExpandedChangereceives{ "0": true }, then{}fromtable_resetExpanded. - "same data" renders
false.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://stackblitz.com/github/NickSpag/svelte-table-controlled-state-repro
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem along side this issue
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- 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.
- Langage dominant
- TypeScript
- Étoiles
- 28.5k
- Forks
- 3.6k
- Merge moyen
- 18 h 5 min
- PR mergées (30 j)
- 12
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TanStack/table
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
Column resize does not end if mouseup is missed (screenshot, switching tabs)Peut-être pris @lx3133584 l’a pris aujourd’hui. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 38/100
TanStack/table#6601 · 5 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Cast required to access custom options when defining a custom plugin/featurePeut-être pris @sorena-paydar l’a pris il y a 46 jours. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 1 jour
-
`aggregatedCell` not typed against bound `cellComponents` in `createAppColumnHelper`Peut-être pris @cpruijsen l’a pris il y a 56 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TanStack/table
Issues similaires
-
Add: ESP 2 ROOuverteapproved check:passed streams:add
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 1 jour
-
ipaas: Configure form shows "Deploy to apply." and "Overrides selected Link" when they don't applyOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
wso2/integration-control-plane#1118 ·
Les mainteneurs répondent en général sous 1 jour
-
File reporting form UI DesignOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
UTDNebula/utd-notebook#311 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
binding:python bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour