Repository navigation
fix(views): table view search, filters, selection and rows - #13885
yuxi-liu-wired wants to merge 14 commits into
Conversation
| ;; Identifies the view whose previous paint may stay on screen while the | ||
| ;; next result loads. The search input is left out: typing must keep the | ||
| ;; old table mounted so the search box is not unmounted mid-keystroke. | ||
| :previous-paint-key (pr-str (dissoc window-context :input)) |
There was a problem hiding this comment.
🟡 Old results survive non-windowed filter changes
Changing filters or sorting in non-windowed views leaves previous-view-data visible while the new result loads. Their window-context is nil, so previous-paint-key never changes and the old rows remain selectable under the new settings.
Learn more
A non-windowed view fetches its rows with full-context, while window-context remains nil. Its resource key changes on sorting, filtering, or query row changes, but its previous-paint key stays constant. The paint source then continues to use the previous rows until the new resource arrives. This leaves old rows interactive under changed controls.
Example: In Linked References, apply a filter that excludes every row. Until the new resource loads, the previous rows remain visible and selectable beneath the active filter.
Recommended fix: Derive previous-paint-key from (or window-context full-context), excluding only :input. Add a non-windowed view plan test verifying that filter and sort changes alter this key.
| :previous-paint-key (pr-str (dissoc window-context :input)) | |
| :previous-paint-key (pr-str (dissoc (or window-context full-context) :input)) |
Was this helpful? React with 👍 or 👎 to provide feedback.
| ;; Keep previous paint for same-context refetches (delete) and for | ||
| ;; search input changes, so the search box stays mounted while typing. | ||
| ;; A new filter/sort key must not keep the old 431-row table. | ||
| (set-previous-view-data! nil) | ||
| js/undefined) | ||
| [(:previous-paint-key plan)]) |
There was a problem hiding this comment.
| (ns frontend.components.block.page-reference-test | ||
| (:require ["react" :as react] | ||
| ["react-dom/server" :as react-dom-server] | ||
| [cljs.test :refer [deftest is testing]] | ||
| [clojure.string :as string] | ||
| [frontend.components.block :as block] | ||
| [goog.object :as gobj])) |
|
Thanks for the review.
|
4045b6b to
252b566
Compare
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
69cf18a to
57baf23
Compare
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
…ws (squashed: its commits conflicted one by one with the stack)
4a74cee to
d8f3b63
Compare
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
…ws (squashed: its commits conflicted one by one with the stack)
…ws (squashed: its commits conflicted one by one with the stack)
…ws (squashed: its commits conflicted one by one with the stack)
d8f3b63 to
96f65e9
Compare
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
…ws (squashed: its commits conflicted one by one with the stack)
…ws (squashed: its commits conflicted one by one with the stack)
96f65e9 to
f814e16
Compare
…ws (squashed: its commits conflicted one by one with the stack)
6405b05 to
41be003
Compare
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
04d04c0 to
53066e9
Compare
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
53066e9 to
1a4c2e5
Compare
…ws (squashed: its commits conflicted one by one with the stack)
…ws (squashed: its commits conflicted one by one with the stack)
A table view's name column, such as Linked References as a table, showed `[[]] is here` for a block that references a journal page. The same view as a list showed the page link. It happened after the journal date format was changed in Settings. A reference without a label is rendered with an empty string as its label. When the page lookup misses, `page-cp-inner` falls back to `(or label (:block/name page))`. An empty string is truthy in ClojureScript, so the fallback printed the empty label between the brackets instead of the page name. Changing the journal date format makes the lookup miss, because the title text in the table row no longer matches the stored journal page name. The fallback now uses the page name when the label is blank, the same blank check that `page-inner` already uses for the label. The new test renders `page-cp-inner` for a page that only has a name, with a nil, an empty and a real label. Fixes logseq/db-test#1407
Hovering a row in a tag view table showed the "Open" and "Open in sidebar" buttons twice: once in the Page name column and once in a text property column such as Description. Text property cells render through `block-title`, which draws the hover buttons for any cell. The buttons were meant for the name column only, so every text column repeated them. `block-title-interactive` now draws the buttons only when the cell is the name column (`:property-ident` is `:block/title`). Clicking the cell to edit it and shift-click to open it in the sidebar are unchanged. The new test renders the cell for the name column and for a text property and counts the buttons. This does not cover the buttons that reportedly do not appear in the All Pages name column; that part of the issue is not changed here. Refs logseq/db-test#1266
…filter or sort In views that are not windowed, such as Linked References, changing a filter or the sort order left the old rows on screen, and selectable, until the new result arrived. The previous paint is reset when `:previous-paint-key` changes. The key was built from the window context only, and a non-windowed view has no window context, so the key never changed there. The key now falls back to the full context when there is no window context. The search input is still left out of it, so typing keeps the table mounted. The new test builds the resource plan for a non-windowed view and checks that the key stays the same for a different search input and changes for a different sort order or filter.
In the All Pages table, selecting a page, then shift-clicking the checkbox of another page far enough down selected only those two pages. The delete confirmation listed just the first and the last page. A shift-click range was computed over the table's `:data`. In a windowed table such as All Pages, `:data` holds only the rows of the first window, while the whole ordered list is in `:full-data`. The second page was not in the window, so its index was -1 and the range between the two clicks was empty. The range now runs over `:full-data` for a flat table, and over the group for a group table. A clicked row that is not in the list no longer cancels the click, so it toggles like a normal click. The gallery card checkbox shares the same helpers. The new unit test shift-clicks a row past the painted window and checks that every row between the two clicks is selected, for a flat table and for a group table. The e2e test creates 45 pages, selects the first, shift-clicks the checkbox of a page below the first window, and checks the selection count and the pages listed in the delete confirmation. Fixes logseq/db-test#1096
…d is not On a table view such as All Pages, a filter set to "Tags is Empty" crashed the page with "Invalid view resource context" as soon as the operator was switched between "is" and "is not". The broken filter was saved on the view, so the page kept crashing until the filter was removed. When the operator changes, the worker decides which value the filter keeps. For "is" and "is not" it kept the value only if it was a set, but the Empty choice is stored as the keyword :empty, so it was dropped. The UI then saved a two-element clause such as [:block/tags :is], which view resource validation rejects. view-filter-value-after-operator-change now also keeps :empty for "is" and "is not". The views.cljs call site already passes the current value and stores what the worker returns, so it needs no change. Added view-filter-data-keeps-empty-value-when-switching-is-and-is-not, which checks that :empty survives a switch to :is and :is-not and is still dropped for an operator that cannot use it (:text-contains). Fixes logseq/db-test#1434
…th a single is clause In a query table, a grouped table or a linked-references table, a filter such as "Author is Smith" on a text property showed only one of the blocks whose Author is Smith. The same filter in a tag's table, or with the clause added a second time, showed all of them. Every block stores its text in its own value block, and the filter's value list keeps one entry per distinct text. For a single is or is-not clause on a ref property, build-fast-filter-pred compared the ids of the value blocks, so only the block whose value block was listed matched. row-matched? compares the text in this case, which is why a second clause gave the expected rows. Properties with choices share one value block per choice and were not affected. build-fast-filter-pred now makes the same choice as row-matched?: a value that is not matched as an entity is compared by its content instead of its id. Added get-view-data-query-result-is-filter-matches-equal-text-in-separate-value-blocks-test, which filters a query table on the text of one of two blocks that have the same text and expects both, and the other block for is-not. Fixes logseq/db-test#1054
On a table view, changing a Text filter from "is" to "text contains" (or "text not contains") replaced the table with "Invalid view resource context" before a search string could be typed. The incomplete clause was saved on the view, so the error stayed after a reload. When the operator changes, the old selected values are cleared and the clause is saved as [property operator], and the filter editor produces the same two-element clause for a newly added Text filter. Persistence also drops a nil value on purpose, and both filter matchers treat a clause without a value as matching every row. Only the view resource context validation required exactly three elements, so it rejected a clause the rest of the code accepts. The validation now accepts clauses with two or three elements. A clause of any other length is still rejected and is reported as the view's error message instead of failing the whole snapshot. Views that already have such a clause saved render again without being edited. Added view-data-resource-accepts-filter-clauses-without-a-value-test, which requests a view with two valueless clauses and expects no error and the clauses passed to the view query, and checks that clauses with one or four elements are still reported as an isolated view error. Fixes logseq/db-test#1392
… with its icon In a table view grouped by a property with closed values (such as Status), a value the user added themselves showed no icon in the group header and sorted to one end of the list instead of at its place in the value dropdown. The values that ship with Logseq were fine. Cause: `get-view-data` keeps a closed value as an entity group key only if `match-property-value-as-entity?` says so, and that is true only for values with a `:db/ident` (the built-in ones) when the property is of a text type. A value the user added has no ident, so the group key became its text. The group sort reads `:block/order` of the key and the header reads `:logseq.property/icon` of it; a string has neither, so the group sorted lowest and had no icon. Change: when the grouped property has closed values, `get-view-data` keeps the closed value entity as the group key whether or not it has an ident. Test: `get-view-data-group-by-user-added-closed-value-keeps-the-value-entity-test` groups by a property whose dropdown order differs from the alphabetical one and whose second value has an icon. It runs in the main test bundle because nbb does not support the `:property/closed-values` lookup. Fixes logseq/db-test#1303
… query table In the table of a query result, the Filter menu of a property such as Status offered only `Todo`, whatever values the query rows had. Cause: the filter menu asked the worker for the values of the rows with `:query-entity-ids`, an option that the data-fetch refactor (fb1047d) replaced with `:query-row-uuids` in the view, so it was always nil. `get-property-values` then fell back to the entities of the view, which a query-result view does not have, and added only the default value of the property. Change: the filter menu passes `:query-row-uuids`, and `view-filter-data` in the worker resolves them to the entity ids that `get-property-values` reads, as the view resource does. Test: `view-filter-data-lists-the-values-of-the-query-result-rows` asks for the values of a property for two of three tagged blocks and expects only their values. Fixes logseq/db-test#1413
In the All Pages table, a page whose title is blank or only its uuid had an empty name cell. The row could not be recognised, and the only thing left in it was the hover arrow. Cause: the name cell printed the title text of the row with no fallback. Page references, the left sidebar and the route title already show `Untitled` for such pages. Change: the name cell, in both the first-window paint and the full cell, shows `Untitled` when the first line of the title is blank or a uuid. Test: `table-name-cell-shows-untitled-for-a-page-without-title-test` renders the name cell and the first-window name cell for a blank, a whitespace, a missing and a uuid title, and for a normal title. Fixes logseq/db-test#1228
…atch any" is set
In a query table, a list view or a grouped table, removing the last filter while "Match any" was set made every row disappear. The same view as a flat table showed all rows.
Cause: `get-view-data` filters through `row-matched?` when the view is not a flat table, and it enters that path when the filters map is not empty, which `{:or? true :filters []}` is. `row-matched?` then ran `some` over no clauses, which is nil, so no row matched. The id path for flat tables already treats no clauses as match-all.
Change: `row-matched?` matches every row when there are no clauses, whatever `:or?` is. The search input still applies.
Test: `get-view-data-query-result-match-any-without-clauses-keeps-every-row-test` (no clauses with `:or?` true and false, with and without a search input). Found by the view filter fuzzer.
…value Choosing another operator for a filter that has no value yet (a new Name filter, or a cleared number or range) did nothing: the menu item threw and no error showed. Cause: the operator menu read the old value with `(nth clause 2)`, but a clause with no value is `[property operator]`, which has two elements. Those clauses are legal: the number and range inputs and `table-filters->persist-state` produce them on purpose. Change: the operator change moves into `<change-filter-operator!` and reads the old value with `(nth clause 2 nil)`. Test: `change-filter-operator-of-a-filter-without-value-test` (on master's code it fails with "No item 2 in vector of length 2"). Found by the view filter fuzzer. This is the second half of the class of logseq/db-test#1443; the worker side (`valid-filters?` rejecting two-element clauses) is in logseq#13885.
… merges cleanly with logseq#13872 The tests this PR added to views_test.cljs sat at the same place as the ones logseq#13872 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.components.views-1398-test, which carries the requires and the render-static helper they need, and views_test.cljs is back to master's.
Master's 274eae1 derives a built class's ident from its title, so :user.class/Topic no longer names the class the test builds and the test created its view for no class.
1a4c2e5 to
58f6303
Compare
…ws (squashed: its commits conflicted one by one with the stack)
Combines the PRs of this theme, to keep the number of open PRs down; the commits are unchanged. CI's unit suite passes on the combined branch.
fix(views): table view search, unresolved page refs and duplicated row buttons (was #13885)
Fixes logseq/db-test#1407, fixes logseq/db-test#1096; part of logseq/db-test#1266 (the duplicated buttons; the buttons missing in All Pages are not changed).
Three fixes for table views, one commit each. logseq/db-test#1398 (the search box disappears on the first keystroke) is fixed on master by #13590 (fe7660b); this PR's commit for it is dropped, and its review follow-up below is ported onto master's code. The table view issues #1100, #1123 and #1240 are not in this PR (see the end).
What the user sees
[[]] is hereinstead of the page name. It happens after the journal date format was changed in Settings. The list view is fine.Cause
page-cp-innerfalls back to(or label (:block/name page)). An empty string is truthy in ClojureScript, so the fallback printed the empty label between the brackets instead of the page name. Changing the journal date format makes the lookup miss, because the title text in the table row no longer matches the stored journal page name.block-title, which draws the hover buttons for every cell. They were meant for the name column only.:data. In a windowed table such as All Pages,:dataholds only the rows of the first window, while the whole ordered list is in:full-data. A clicked row below the window had index -1, so the range between the two clicks was empty. The e2e test showedSelected: 2where 40 were expected.view-paint-identity(fix: keep table search mounted during view-data refetch #13590) is built from the window context, which is nil in a non-windowed view, so the identity never changes there and the old paint is kept.Change
page-cp-inneruses the page name when the label is blank, the same blank check thatpage-inneralready uses.block-title-interactivedraws the buttons only when:property-identis:block/title(the name column). Click to edit and shift-click to open in the sidebar are unchanged. The report that the buttons are missing in the All Pages name column is not traced or changed here.:full-datafor a flat table and over the group for a group table (table-range-rows,table-row-index,select-table-row-range!). A clicked row that is not in the list no longer cancels the click, so it toggles like a normal click. The gallery card checkbox uses the same helpers.view-paint-identitytakes the resource plan and falls back to the full context when there is no window context, still without the search input.Tests
paint-identity-changes-with-sort-and-filter-of-a-non-windowed-view-test(views_1398_test.cljs): for a Linked References plan the paint identity is the same for different search inputs and changes for a different sort or filter.unresolved-page-reference-shows-its-name-test(block/page_reference_test.cljs):page-cp-innerfor a page that only has a name shows the name for a nil or empty label and the label when there is one.open-buttons-render-only-in-the-name-column-test(views_test.cljs): the name column cell has two buttons, a text property cell has none.shift-click-selects-the-range-past-the-painted-window-test(views_test.cljs): shift-clicking a row past the painted window selects every row between the two clicks, for a flat table and for a group table.all-pages-shift-click-selects-the-range-past-the-first-window-test(clj-e2e/test/logseq/e2e/view_basic_test.clj): creates 45 pages, selects the first row, scrolls and shift-clicks the checkbox of a page below the first window, then checks the selection count and the pages listed in the delete confirmation. It fails on a build without the fix (Selected: 2) and passes on a build with it.Each unit test fails without its fix and passes with it, and the whole CI suite passes with each fix (the last suite run had one
db-worker-nodeworker fail under load, and the same namespaces passed when rerun alone).Not in this PR
#column): a test inviews_test.cljsand a commit message say the#column must stay hidden for every table, so showing it again reverses a maintainer decision.fix(views): table filters keep working when a clause is empty or matches text values (was #13884)
Fixes logseq/db-test#1434, fixes logseq/db-test#1392, fixes logseq/db-test#1054.
Three table view filter bugs, one commit each.
What the user sees
Cause
view-filter-value-after-operator-change(src/main/frontend/worker/handler/view.cljs) kept the value for:isand:is-notonly when it was a set. The Empty choice is stored as the keyword:empty, so it was dropped and the two-element clause[:block/tags :is]was saved.table-filters->persist-state), the editor creates[property :text-contains]for a new Text filter, and both filter matchers (row-matched?andeid-clause-match?) treat a clause without a value as matching every row. Onlyvalid-filters?insrc/main/frontend/worker/handler/render_resource/view.cljsrequired exactly three elements, so it rejected a clause the rest of the code accepts. The clause is therefore valid and the validation was wrong, and the code that builds clauses is unchanged. Click the Advanced Queries block and don't jump to the target. #1434 is a separate bug in which a value that should have been kept was lost, so it is fixed where the clause is built.:isor:is-notclause on a ref property,build-fast-filter-pred(deps/db/src/logseq/db/common/view.cljs) compared value block ids, so only the block whose value block was listed matched.row-matched?compares the text for such values, which is why a second clause gave the expected rows. Properties with choices share one value block per choice and were not affected.Change
view-filter-value-after-operator-changealso keeps:emptyfor:isand:is-not.valid-filters?accepts clauses with two or three elements. A clause of any other length is still rejected, and the worker already reports that as the view's error message (isolated-view-failure) instead of failing the whole snapshot. Views that already have such a clause saved render again without being edited.build-fast-filter-predmakes the same choice asrow-matched?: a value that is not matched as an entity (match-property-value-as-entity?) is compared by its content instead of its id.Tests
view-filter-data-keeps-empty-value-when-switching-is-and-is-not(src/test/frontend/worker/handler/view_test.cljs). Fails without the fix (2 failures), passes with it.view-data-resource-accepts-filter-clauses-without-a-value-test(src/test/frontend/worker/handler/render_resource_test.cljs). Requests a view with two valueless clauses and expects no error and the clauses passed to the view query; also checks that clauses with one or four elements are still an isolated view error. Fails without the fix (2 failures inrender-resource-test, 95 tests), passes with it, and the whole main-bundle suite passes.get-view-data-query-result-is-filter-matches-equal-text-in-separate-value-blocks-test(deps/db/test/logseq/db/common/view_test.cljs). Filters a query table on the text of one of two blocks with the same text. Without the fix:isreturns one of the two blocks and:is-notreturns the other matching block (2 failures); with it:isreturns both and:is-notreturns only the block with different text. The wholedeps/dbsuite passes (201 tests, 766 assertions).Added: issues from the second triage pass and the view filter fuzzer
Fixes logseq/db-test#1413, Fixes logseq/db-test#1303, Fixes logseq/db-test#1228, Fixes logseq/db-test#1443.
One commit per issue, each with its test, plus two commits for bugs of the same classes that a view filter fuzzer (random filter edits as the UI makes them, checked against the worker's view-data resource and an independent row matcher) found. With this PR the fuzzer goes from 9 distinct failures on master to 1 (the cleared text filter below, which needs a decision). #1443 (changing the operator of a datetime filter gives "Invalid view resource context") is fixed in two parts: the resource accepting a clause with no value (commit 252b566 above, test
view-data-resource-accepts-filter-clauses-without-a-value-test) and the operator menu no longer throwing on such a clause (the second fuzzer section below).Found by the view filter fuzzer (same classes)
match anywith no clauses hides every row (class of #1413 and #1443: states the UI can produce)What the user sees: in a query table, a list view or a grouped table, removing the last filter while "Match any" is set shows no rows. The flat table shows all of them.
Cause:
get-view-datagoes throughrow-matched?for views that are not flat tables, and it enters that path when the filters map is non-empty, which{:or? true :filters []}is.row-matched?ransomeover no clauses, which is nil. The id path for flat tables already treats no clauses as match-all.Change:
row-matched?matches every row when there are no clauses. The search input still applies.Test:
get-view-data-query-result-match-any-without-clauses-keeps-every-row-test(deps/db, nbb). On master it returns no rows.Changing the operator of a filter that has no value does nothing (class of #1443)
What the user sees: a new Name filter, or a cleared number or range, cannot get another operator: the menu item throws and nothing shows.
Cause: the operator menu read the old value with
(nth clause 2), but a clause with no value is[property operator](the number and range inputs andtable-filters->persist-stateproduce them on purpose).Change: the operator change moves into
<change-filter-operator!, which reads the old value with(nth clause 2 nil).Test:
change-filter-operator-of-a-filter-without-value-test. On the old expression it fails with "No item 2 in vector of length 2".Left to other PRs or a decision
is/is-noton a text, number or url property compares value-entity identity on the entity path (bug 5): both are fixed by the earlier commits of this PR (252b5662ed,0aca17fe60); the fuzzer finds neither.[:p :text-contains ""]) restricts the rows to those that have a value, while a cleared number input stores a clause with no value (fuzzer bug 7). Either the text input stores[p op]for a blank input, or the db view treats a blank match as no restriction. This needs a decision, not changed here.#1413: the filter menu of a query table lists only
Todofor StatusWhat the user sees: in the table of a query result (for example
#task), the Filter menu of the Status property offers onlyTodo, whatever values the rows have.Cause: the filter menu asked the worker for the values of the rows with
:query-entity-ids, an option that the data-fetch refactor (fb1047d) replaced with:query-row-uuidsin the view, so it was always nil.get-property-valuesthen fell back to the entities of the view, which a query-result view does not have, and added only the default value of the property (Todo).Change: the filter menu passes
:query-row-uuids, andview-filter-datain the worker resolves them to the entity ids thatget-property-valuesreads, as the view resource does.Test:
view-filter-data-lists-the-values-of-the-query-result-rows(two of three tagged blocks are rows of the query; only their values are listed). On master it returns no values.Not checked at runtime: the Name filter that the issue says is missing is not explained by the code (
filterable-column?keeps:block/title), so I did not change it; it should be looked at in the UI with this fix.#1303: a user-added closed value has no icon in its group header and sorts to one end
What the user sees: in a table view grouped by Status, a Status value the user added shows its emoji in the rows, but its group header has no icon, and its group is first or last instead of at its place in the value dropdown.
Cause:
get-view-datakeeps a closed value as an entity group key only ifmatch-property-value-as-entity?says so, and for a text property that is true only for values with a:db/ident(the built-in ones). A value the user added has no ident, so the group key became its text. The group sort reads:block/orderof the key and the header reads:logseq.property/iconof it; a string has neither.Change: when the grouped property has closed values,
get-view-datakeeps the closed value entity as the group key whether or not it has an ident.Test:
get-view-data-group-by-user-added-closed-value-keeps-the-value-entity-test(a property whose dropdown order is Charlie, Alpha, Bravo, with an icon on Alpha; ascending, descending and the icon of the group key). It is in the main test bundle (src/test/logseq/db/common/view_group_test.cljs) because nbb does not support the:property/closed-valueslookup. On master the group keys are strings.#1228: the name cell of a page without a title is empty
What the user sees: in the All Pages table, a page whose title is blank or only its uuid has an empty name cell, with only the hover arrow, so it cannot be recognised.
Cause: the name cell printed the first line of the title with no fallback. Page references (
page-reference), the left sidebar and the route title already showUntitledfor such pages.Change: the name cell, in both the first-window paint and the full cell, shows
Untitledwhen the first line of the title is blank or a uuid. Any row whose title is blank gets it, not only pages.Test:
table-name-cell-shows-untitled-for-a-page-without-title-test(blank, whitespace, missing and uuid titles in both cells, and a normal title unchanged). On master the cells are empty or show the uuid.Not changed: "select and delete does nothing" is logseq/db-test#1207. How the untitled pages were created is still unknown.
Validation
Run with the heavy build: the new tests fail on master and pass with the fixes (the 1303 and 1413 tests fail on a master build, the 1228 test on a build with the first two fixes, which do not touch its code, the operator test on the old
nth, the match-any test in nbb without the fix). The view filter fuzzer (100 seeds x 12 steps,FUZZ view-filter cases=100 steps=12 seed=1): on master 9 distinct failures (failurescounts per invariant: resource-rejects-ui-state 367, ui-throws 22, filter-rows 53, filter-values 33, group-closed 11); on this branch alonefailures=4(resource-rejects-ui-state, and filter-rows for bug 5 and bug 7); on this branch with the two #13885 commits appliedfailures=1(bug 7 only). The fuzzer'sui-view-argsand operator-menu mirror were updated to the fixed UI code. CI's whole unit suite (pnpm cljs:run-test) passes on the branch,clj-kondoreports 0 errors and 0 warnings on the changed files, and the typos check is clean.