From 37b5ea9647e7c14c14a3cf50a4be37482315b195 Mon Sep 17 00:00:00 2001 From: zugdev Date: Sun, 5 Jan 2025 13:59:01 -0300 Subject: [PATCH 1/2] feat: dont clear search --- src/home/sorting/sorting-manager.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/home/sorting/sorting-manager.ts b/src/home/sorting/sorting-manager.ts index cbe7ee0..14ba452 100644 --- a/src/home/sorting/sorting-manager.ts +++ b/src/home/sorting/sorting-manager.ts @@ -179,9 +179,6 @@ export class SortingManager { input.value = isFilteringAvailableIssues ? "Unassigned" : "All Issues"; try { - // Clear search when applying the filter - this._resetSearchBar(); - const { sortingOption, sortingOrder } = this._detectSortingState(); void displayGitHubIssues({ sorting: sortingOption as Sorting, From f5dc917aa09f836dbc0390ea135cc346fd637376 Mon Sep 17 00:00:00 2001 From: zugdev Date: Sun, 5 Jan 2025 14:19:23 -0300 Subject: [PATCH 2/2] feat: fix mdoal not loading from URL --- src/home/fetch-github/fetch-and-display-previews.ts | 13 ++++++++++++- src/home/home.ts | 2 +- src/home/sorting/sorting-manager.ts | 4 ++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/home/fetch-github/fetch-and-display-previews.ts b/src/home/fetch-github/fetch-and-display-previews.ts index e6edbc8..442393b 100644 --- a/src/home/fetch-github/fetch-and-display-previews.ts +++ b/src/home/fetch-github/fetch-and-display-previews.ts @@ -13,10 +13,21 @@ export type Options = { ordering: "normal" | "reverse"; }; -export let isFilteringAvailableIssues = true; +// decide initial value based on URL +export let isFilteringAvailableIssues = (new URLSearchParams(window.location.search).get("allIssues") === "true") ? false : true; export function swapAvailabilityFilter() { isFilteringAvailableIssues = !isFilteringAvailableIssues; + + //url part + const newURL = new URL(window.location.href); + if(isFilteringAvailableIssues){ + newURL.searchParams.delete("allIssues") + } else { + newURL.searchParams.set("allIssues","true"); + } + console.log(newURL.toString()); + window.history.replaceState({}, "", newURL.toString()); } // start at view based on URL diff --git a/src/home/home.ts b/src/home/home.ts index 8a7b233..9d0abba 100644 --- a/src/home/home.ts +++ b/src/home/home.ts @@ -38,7 +38,7 @@ void (async function home() { void authentication(); void readyToolbar(); await taskManager.syncTasks(); // Sync tasks from cache on load - loadIssueFromUrl(); // Load issue preview from URL if present + await loadIssueFromUrl(); // Load issue preview from URL if present void displayGitHubIssues(); // Display issues from cache await postLoadUpdateIssues(); // Update cache and issues if cache is outdated diff --git a/src/home/sorting/sorting-manager.ts b/src/home/sorting/sorting-manager.ts index 14ba452..58437cf 100644 --- a/src/home/sorting/sorting-manager.ts +++ b/src/home/sorting/sorting-manager.ts @@ -173,6 +173,10 @@ export class SortingManager { input.type = "button"; input.value = "Unassigned"; input.id = `filter-availability-${this._instanceId}`; + // decide initial value based on URL + if(new URLSearchParams(window.location.search).get("allIssues") === "true"){ + input.value = "All Issues"; + } input.addEventListener("click", () => { swapAvailabilityFilter();