Skip to content

Fix checkbox sort treating unchecked as missing - #13486

Merged
tiensonqin merged 2 commits into
masterfrom
logseq/fix-checkbox-sort-false-819b
Oct 12, 2026
Merged

tiensonqin merged 2 commits into
masterfrom
logseq/fix-checkbox-sort-false-819b

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1321

Problem

Sorting a tag table by a checkbox used the same order for ascending and descending. An unchecked box (false) was treated as a missing property and sorted last in both directions.

sort-eids-by-sorting built its value map with if-let, which skips false. The entities path (get-value-for-sort) keeps boolean? values, so query tables over the same valued rows already sorted unchecked before checked.

Change

  • Use if-some so false is a real sort value.
  • Tag-table ascending: unchecked, checked, then missing last.
  • Tag-table descending: checked, unchecked, then missing last.

Tests

Added get-view-data-class-objects-checkbox-sort-treats-false-as-a-value-test covering tag-table asc/desc, the missing-property last contract, and query-table alignment.

Link to Devin session: https://app.devin.ai/sessions/9c56667e89964af98b7414426bb36471
Open in Devin Desktop: https://app.devin.ai/desktop/session/9c56667e89964af98b7414426bb36471?variant=devin
Requested by: @megayu

@devin-ai-integration
devin-ai-integration Bot force-pushed the logseq/fix-checkbox-sort-false-819b branch from 53bcf7a to 647ee39 Compare October 2, 2026 08:56
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 2, 2026 09:03

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

End-to-end app-UI verification of the checkbox false sort fix (issue logseq/db-test#1321). Ran the web dev app (pnpm watch, localhost:3001) and built a db graph with tag Topic + Checkbox property done; rows checked (done=true), unchecked (done toggled on→off, stored false), missing (property never set).

Before (master) — sorting done ascending puts unchecked last, exactly like the missing row (it was dropped by if-let):

master ascending: checked, missing, unchecked

After (this branch) — same graph reloaded after the worker recompiled; ascending correctly puts false first and keeps the missing row last:

fix ascending: unchecked, checked, missing

Descending + extra evidence

Fix descending: checked, unchecked, missing — false sits between true and missing:

fix descending: checked, unchecked, missing

On master, descending gave checked, unchecked, missing only by eid tie-break luck — the false row is indistinguishable from missing and the pair swaps with direction while checked stays first; with the default Updated-At secondary sort, both directions produced the identical order checked, missing, unchecked.

Verified in the Logseq dev app; recordings of both runs are attached to the verification session.

cursoragent and others added 2 commits October 12, 2026 09:54
Tag-table sorting by a checkbox should reverse unchecked/checked and
keep an unset property last. Query tables over the same valued rows
already do this.

Co-authored-by: Tienson Qin <[email protected]>
sort-eids-by-sorting used if-let, which skipped false, so an unchecked
box sorted like a missing property and did not reverse with direction.

Co-authored-by: Tienson Qin <[email protected]>
@megayu
megayu force-pushed the logseq/fix-checkbox-sort-false-819b branch from 647ee39 to c3b12bb Compare October 12, 2026 01:54
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.

Sorting a tag table by a checkbox gives the same order ascending and descending

3 participants