Skip to content

fix(state): sort object keys before preview pagination - #1167

Closed
shuaiyafei wants to merge 2 commits into
vuejs:mainfrom
shuaiyafei:fix/state-preview-order
Closed

shuaiyafei wants to merge 2 commits into
vuejs:mainfrom
shuaiyafei:fix/state-preview-order

Conversation

@shuaiyafei

@shuaiyafei shuaiyafei commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Loading more object properties should append the next alphabetically ordered batch without moving previously displayed rows. Sort the complete key list before slicing previews, and sort the frozen key snapshot used by cursor pagination so both paths agree.

Regression coverage exercises initial previews, show-more expansion, and cursor pages with 65 properties inserted in reverse order. Explicit key snapshots retain their supplied order, while arrays, Map, and Set keep their existing collection order.

Addresses the stable-ordering request in #1143.

Validation: pnpm build, pnpm check, pnpm test (408 passed), pnpm typecheck, and git diff --check.

@netlify

netlify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vue-devtools-docs canceled.

Name Link
🔨 Latest commit ae37064
🔍 Latest deploy log https://app.netlify.com/projects/vue-devtools-docs/deploys/6ad1f183bfbd17cb682095d2

@pkg-pr-new

pkg-pr-new Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vue/devtools-agent@1167
npm i https://pkg.pr.new/@vue/devtools-api@1167
npm i https://pkg.pr.new/@vue/devtools-kit@1167
npm i https://pkg.pr.new/vite-plugin-vue-devtools@1167

commit: ae37064

@webfansplz

webfansplz commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Thanks for the PR.

#1143 was reported against v7.7.7, where StateFieldViewer.vue sliced the first N keys and then sorted only that slice. That's what caused rows to reshuffle on "Show more". In v9 the encoder slices keys in insertion order and nothing sorts them afterwards, so "Show more" already appends the next batch without moving earlier rows.

Given that, this PR would mainly change the display order from insertion order to alphabetical. We'd rather keep insertion order, since it usually matches how state is declared.

@webfansplz webfansplz closed this Oct 18, 2026
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.

2 participants