Skip to content

Fix: keep list and tuple element order in assigns - #1012

Merged
hhubert6 merged 1 commit into
software-mansion:mainfrom
RaphaelFakhri:fix-list-tuple-element-order
Oct 26, 2026
Merged

hhubert6 merged 1 commit into
software-mansion:mainfrom
RaphaelFakhri:fix-list-tuple-element-order

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

Fixes #1011

Summary

  • Stop sorting list and tuple elements in TermParser.to_children/1. Elements now display in their real order, so {:ok, 5} no longer renders as {5, :ok}.
  • List diffs from TermDiffer are positional, so incremental updates now land on the right children and match a fresh render.
  • Map, struct and keyword keys stay sorted as introduced in Enhancement: Sort children in TermNode #896.

Validation

  • mix test test/app/utils/term_parser_test.exs: the two new tests fail without the fix (32 tests, 2 failures) and pass with it (32 tests, 0 failures).
  • mix test: 507 tests, 0 failures.
  • mix format --check-formatted and mix credo: no issues.

TermParser sorted list and tuple elements before building display nodes, so {:ok, 5} rendered as {5, :ok} and list diffs were applied by index to the sorted children.
@srzeszut
srzeszut requested review from hhubert6 and a balanced review from Copilot October 26, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix aligns rendering with positional diffs and includes targeted regression coverage, with no identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes #1011 by preserving list and tuple element order in the Assigns display, keeping rendering consistent with positional updates.

Changes:

  • Removes sorting from list and tuple child generation while leaving keyed sorting unchanged.
  • Adds regression tests for element order and incremental list updates matching a fresh render.
File Description
test/​app/​utils/​term_parser_test.exs Tests list and tuple ordering and incremental update consistency.
lib/​live_debugger/​app/​utils/​term_parser.ex Preserves original element order when generating indexed children.

Review effort: Balanced

@hhubert6 hhubert6 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐬

@hhubert6
hhubert6 merged commit ebb3bde into software-mansion:main Oct 26, 2026
5 checks passed
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.

Assigns view shows list and tuple elements in sorted order instead of their real order

3 participants