Skip to content

Commit

Permalink
CLDR-15649 Dashboard using filters, fix checkbox performance (#3662)
Browse files Browse the repository at this point in the history
  • Loading branch information
btangmu authored May 1, 2024
1 parent 7cf55b1 commit 3256844
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 7 additions & 1 deletion tools/cldr-apps/js/src/views/DashboardWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,13 @@ export default {
},
catCheckmarkChanged(event, category) {
this.catIsHidden[category] = !event.target.checked;
// setTimeout solves a weakness in the Vue implementation: if the number of
// notifications is large, the checkbox in the header can take a second or more
// to change its visible state in response to the user's click, during which time
// the user may click again thinking the first click wasn't recognized. Postponing
// the DOM update of thousands of rows ensures that the header checkbox updates
// without delay.
setTimeout(() => (this.catIsHidden[category] = !event.target.checked), 0);
},
canBeHidden(cats) {
Expand Down
15 changes: 12 additions & 3 deletions tools/cldr-apps/js/test/TestCldrDash.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ describe("cldrDash.updatePath", function () {
assert.strictEqual(countEntriesForPath(data1, "710b6e70773e5764"), 1);
assert.strictEqual(countEntriesForPath(data1, "64a8a83fbacdf836"), 1);
// the entry for 710b6e70773e5764 should have 3 notifications
assert.strictEqual(countNotificationsForEntry(data1, "710b6e70773e5764"), 3);
assert.strictEqual(
countNotificationsForEntry(data1, "710b6e70773e5764"),
3
);
// the entry for 64a8a83fbacdf836 should have 1 notification
assert.strictEqual(countNotificationsForEntry(data1, "64a8a83fbacdf836"), 1);
assert.strictEqual(
countNotificationsForEntry(data1, "64a8a83fbacdf836"),
1
);
});

it("should remove entries", function () {
Expand All @@ -61,7 +67,10 @@ describe("cldrDash.updatePath", function () {
assert.strictEqual(countEntriesForPath(data2, "710b6e70773e5764"), 0);
assert.strictEqual(countEntriesForPath(data2, "64a8a83fbacdf836"), 1);
// the entry for 64a8a83fbacdf836 should have 1 notification
assert.strictEqual(countNotificationsForEntry(data2, "64a8a83fbacdf836"), 1);
assert.strictEqual(
countNotificationsForEntry(data2, "64a8a83fbacdf836"),
1
);
});
});

Expand Down

0 comments on commit 3256844

Please sign in to comment.