Skip to content

fix(views): an unchecked checkbox sorts as false, not as a missing value - #13609

Closed
yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/table-sort-unchecked
Closed

yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/table-sort-unchecked

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1321.

Create a tag Topic with a Checkbox property "done", tag 2 blocks with #Topic, one with "done" checked and one with it unchecked, and sort the Topic table by "done": ascending and descending both list checked, unchecked. An unchecked box sorts like a block without the property, last in both directions.

sort-eids-by-sorting in deps/db/src/logseq/db/common/view.cljs built its value map with (if-let [v (eid-sort-value db schema eid)] (assoc! acc eid v) acc); if-let skips the value false. It now skips only nil.

New test checkbox-sort-orders-unchecked-before-checked-test: it fails on master and passes with the change. logseq.db.common.view-small-set-sort-test, logseq.db.common.view-test and frontend.components.views-test pass.

sort-eids-by-sorting built its value map with if-let, which skips the
value false: an unchecked box counted as a block without the property
and sorted last in both directions, so sorting a tag table by a
checkbox gave the same order ascending and descending (db-test logseq#1321).
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 6, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 8, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 11, 2026
@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

Closing: f7cc544 ("Fix checkbox sort treating unchecked as missing", #13486) fixes the same sort on master, with a test. Thanks!

yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 13, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 16, 2026
@yuxi-liu-wired
yuxi-liu-wired deleted the fix/table-sort-unchecked branch October 21, 2026 18:02
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

1 participant