diff --git a/packages/quantic/force-app/main/default/lwc/quanticSearchInterface/quanticSearchInterface.js b/packages/quantic/force-app/main/default/lwc/quanticSearchInterface/quanticSearchInterface.js index 2789c9a7503..cddae862b0f 100644 --- a/packages/quantic/force-app/main/default/lwc/quanticSearchInterface/quanticSearchInterface.js +++ b/packages/quantic/force-app/main/default/lwc/quanticSearchInterface/quanticSearchInterface.js @@ -125,6 +125,7 @@ export default class QuanticSearchInterface extends LightningElement { } disconnectedCallback() { + this.initialized = false; this.unsubscribeUrlManager?.(); window.removeEventListener('hashchange', this.onHashChange); if (this.ariaLiveEventsBound) { @@ -174,6 +175,13 @@ export default class QuanticSearchInterface extends LightningElement { this.urlManager = CoveoHeadless.buildUrlManager(engine, { initialState: {fragment: this.fragment}, }); + + const isFirstSearchExecuted = engine.state.search.response.searchUid !== ''; + if (isFirstSearchExecuted) { + // Make sure to re-synchronize the search interface when the component gets disconnected and reconnected again. + this.urlManager.synchronize(this.fragment); + } + this.unsubscribeUrlManager = this.urlManager.subscribe(() => this.updateHash() ); diff --git a/packages/quantic/force-app/main/default/lwc/quanticStandaloneSearchBox/quanticStandaloneSearchBox.js b/packages/quantic/force-app/main/default/lwc/quanticStandaloneSearchBox/quanticStandaloneSearchBox.js index 2184da43b10..0e3c7b66d0a 100644 --- a/packages/quantic/force-app/main/default/lwc/quanticStandaloneSearchBox/quanticStandaloneSearchBox.js +++ b/packages/quantic/force-app/main/default/lwc/quanticStandaloneSearchBox/quanticStandaloneSearchBox.js @@ -241,7 +241,7 @@ export default class QuanticStandaloneSearchBox extends NavigationMixin( { type: 'standard__webPage', attributes: { - url: `${this.redirectUrl}#q=${encodeURIComponent(value)}`, + url: `${this.redirectUrl}${value ? `#q=${encodeURIComponent(value)}` : ''}`, }, }, false