File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
packages/atomic/src/components
commerce/atomic-commerce-search-box Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ export class AtomicCommerceSearchBox
229229 return ;
230230 }
231231 if (
232- ! Object . hasOwn ( this . searchBoxState , 'redirectTo' ) ||
232+ ! this . isStandaloneSearchboxState ( this . searchBoxState ) ||
233233 ! Object . hasOwn ( this . searchBox , 'afterRedirection' )
234234 ) {
235235 return ;
@@ -309,6 +309,12 @@ export class AtomicCommerceSearchBox
309309 return Object . hasOwn ( searchBox , 'updateRedirectUrl' ) ;
310310 }
311311
312+ private isStandaloneSearchboxState (
313+ state : SearchBoxState | StandaloneSearchBoxState
314+ ) : state is StandaloneSearchBoxState {
315+ return Object . hasOwn ( this . searchBoxState , 'redirectTo' ) ;
316+ }
317+
312318 private updateBreakpoints = once ( ( ) => updateBreakpoints ( this ) ) ;
313319
314320 private get isSearchDisabledForEndUser ( ) {
Original file line number Diff line number Diff line change @@ -212,6 +212,11 @@ export class AtomicSearchBox implements InitializableComponent<Bindings> {
212212 @AriaLiveRegion ( 'search-suggestions' , true )
213213 protected suggestionsAriaMessage ! : string ;
214214
215+ private isStandaloneSearchBoxState ( ) : this is ( AtomicSearchBox & {
216+ searchBoxState : StandaloneSearchBoxState } ) {
217+ return Object . hasOwn ( this . searchBoxState , 'redirectTo' ) ;
218+ }
219+
215220 private isStandaloneSearchBox (
216221 searchBox : SearchBox | StandaloneSearchBox
217222 ) : searchBox is StandaloneSearchBox {
@@ -252,9 +257,13 @@ export class AtomicSearchBox implements InitializableComponent<Bindings> {
252257 } ) ;
253258 }
254259
260+ private isStandaloneSearchboxState ( state : SearchBoxState | StandaloneSearchBoxState ) : state is StandaloneSearchBoxState {
261+ return Object . hasOwn ( this . searchBoxState , 'redirectTo' )
262+ }
263+
255264 public componentWillUpdate ( ) {
256265 if (
257- ! Object . hasOwn ( this . searchBoxState , 'redirectTo' ) ||
266+ ! this . isStandaloneSearchboxState ( this . searchBoxState ) ||
258267 ! Object . hasOwn ( this . searchBox , 'afterRedirection' )
259268 ) {
260269 return ;
You can’t perform that action at this time.
0 commit comments