Skip to content

Commit 2acb2c7

Browse files
committed
pat-calendar: Do not apply filter, if filter is empty.
1 parent dff47be commit 2acb2c7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/pat/calendar/calendar.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default Base.extend({
9090
agendaDay: "timeGridDay",
9191
},
9292
dayNames: ["su", "mo", "tu", "we", "th", "fr", "sa"],
93-
active_categories: null,
93+
active_categories: [],
9494
parser: parser,
9595

9696
async init($el, opts) {
@@ -361,7 +361,7 @@ export default Base.extend({
361361

362362
filter_event(event) {
363363
let show = true;
364-
if (this.active_categories !== null) {
364+
if (this.active_categories.length) {
365365
// intersection
366366
show =
367367
this.active_categories.filter((it) =>
@@ -377,11 +377,12 @@ export default Base.extend({
377377

378378
reset_active_categories() {
379379
const ctrls = this.get_category_controls();
380-
this.active_categories = null;
380+
this.active_categories = [];
381381
if (ctrls.length) {
382382
this.active_categories = ctrls
383383
.filter((el) => el.checked)
384-
.map((el) => el.id);
384+
.map((el) => el.id)
385+
.filter((it) => it); // no empties
385386
}
386387
this.storage &&
387388
this.storage.set("active_categories", this.active_categories);
@@ -421,7 +422,7 @@ export default Base.extend({
421422
*/
422423
const ctrls = this.get_category_controls();
423424
const active_categories =
424-
(this.storage && this.storage.get("active_categories")) || null;
425+
(this.storage && this.storage.get("active_categories")) || [];
425426

426427
if (!ctrls.length || active_categories === null) {
427428
// No category controls or never set, use default un/checked status.

0 commit comments

Comments
 (0)