From a1ac1876ad2e73d693bd1881ae4f0f6bb2a102bc Mon Sep 17 00:00:00 2001 From: checktheroads Date: Wed, 17 Mar 2021 23:32:01 -0700 Subject: [PATCH] handle selection resets --- netbox/project-static/src/select/api.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netbox/project-static/src/select/api.ts b/netbox/project-static/src/select/api.ts index 6badc3f60..311c4f1a9 100644 --- a/netbox/project-static/src/select/api.ts +++ b/netbox/project-static/src/select/api.ts @@ -181,6 +181,9 @@ export function initApiSelect() { const groupBy = [] as HTMLSelectElement[]; if (isCustomSelect(select)) { + // Store the original URL, so it can be referred back to as filter-by elements change. + const originalUrl = JSON.parse(JSON.stringify(select.dataset.url)) as string; + // Unpack the original URL with the intent of reassigning it as context updates. let { url } = select.dataset; const placeholder = getPlaceholder(select); @@ -297,6 +300,8 @@ export function initApiSelect() { query[name] = target.value; // Create a URL with all relevant query parameters. url = queryString.stringifyUrl({ url, query }); + } else { + url = originalUrl; } // Disable the element while data is loading.