diff --git a/cfgov/unprocessed/apps/tccp/js/htmx.js b/cfgov/unprocessed/apps/tccp/js/htmx.js index 4603fa8fe4..491a84bed3 100644 --- a/cfgov/unprocessed/apps/tccp/js/htmx.js +++ b/cfgov/unprocessed/apps/tccp/js/htmx.js @@ -35,7 +35,7 @@ htmx.defineExtension('htmx-url-param', { }); /** - * htmx extension that stores the page's pathname in web + * htmx extension that stores the page's path in web * storage whenever it's updated * See https://htmx.org/extensions/ * See https://htmx.org/events/#htmx:replacedInHistory @@ -48,6 +48,12 @@ htmx.defineExtension('store-tccp-filter-path', { }, }); +// Store the path on page load before htmx has started up +webStorageProxy.setItem( + 'tccp-filter-path', + window.location.pathname + window.location.search, +); + // Add htmx extensions to the dom and initialize them document.body.setAttribute('hx-ext', 'htmx-url-param, store-tccp-filter-path'); htmx.process(document.body); diff --git a/cfgov/unprocessed/apps/tccp/js/index.js b/cfgov/unprocessed/apps/tccp/js/index.js index 57040188d1..76fe38049e 100644 --- a/cfgov/unprocessed/apps/tccp/js/index.js +++ b/cfgov/unprocessed/apps/tccp/js/index.js @@ -1,13 +1,9 @@ import { attach } from '@cfpb/cfpb-atomic-component'; -import webStorageProxy from '../../../js/modules/util/web-storage-proxy'; - /** * Initialize some things. */ function init() { - // Store the card filter query params to web storage for our breadcrumbs - webStorageProxy.setItem('tccp-filter-path', window.location.pathname); // Attach "show more" click handler attach('show-more', 'click', handleShowMore); }