Skip to content

fix: Avoid duplicate call to autoreset by removing the wrap in _queue #6026

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

smaspe
Copy link

@smaspe smaspe commented May 28, 2025

Fix #6025

the onChange in the memo options is always called once on initialization, for each model.

Several models enqueue a call to _autoResetPageIndex (core model, sorted model, grouped model), which are all resolved together in a Promise. They should all evaluate registered === false.

However, because the call in getGroupedRowModel is wrapped in another layer of _queue:

getMemoOptions(table.options, 'debugTable', 'getGroupedRowModel', () => {
table._queue(() => {
table._autoResetExpanded()
table._autoResetPageIndex()
})
})

the call to _autoResetPageIndex actually resolves later, once registered is true, and it calls table.resetPageIndex().

The wrap in _queue is also not present in

getMemoOptions(table.options, 'debugTable', 'getRowModel', () =>
table._autoResetPageIndex()
)
or in
getMemoOptions(table.options, 'debugTable', 'getSortedRowModel', () =>
table._autoResetPageIndex()
)

As far as I can tell it should not be there.

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

Successfully merging this pull request may close these issues.

GroupedRowModel is incompatible with Pagination
1 participant