Advanced Flows: Search URL Synchronization
The Archibald Search module is designed to keep the browser URL in sync with the search state, allowing for deep-linking to specific search results and filtered views.
URL and Cache Synchronization Flow
Key Considerations
- Isomorphic State: The search term and facets are derived from the URL parameters on both the server (using request headers) and the client (using
window.location). - Cache Keys: Standard hooks like
useSearchTermanduseSearchCategoryuse the stringified and sorted URL parameters as theirFetchKey. This ensures that navigating back and forth in the browser history is instantaneous. - Facet Filtering: When a user clicks a facet, the application updates the URL. The
useSearchhook detects this change and fetches the new filtered result set automatically.