Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/snap-client/src/Client/apis/Abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export class API {
if (cachedResponse) {
this.retryCount = 0; // reset count and delay incase rate limit occurs again before a page refresh
this.retryDelay = 1000;
if (!Array.isArray(cachedResponse)) {
// ignore recommendations array response
// @ts-ignore - _cached does not exist on type
cachedResponse._cached = true;
Comment thread
korgon marked this conversation as resolved.
Outdated
}
return cachedResponse;
Comment thread
korgon marked this conversation as resolved.
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/snap-client/src/Client/transforms/searchResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type breadcrumb = {

export type searchResponseType = {
responseId: string;
_cached?: boolean;
pagination: {
totalResults: number;
begin: number;
Expand Down Expand Up @@ -170,6 +171,7 @@ class Result implements SearchResponseModelResult {

export function transformSearchResponse(response: searchResponseType, request: SearchRequestModel | AutocompleteRequestModel) {
return {
_cached: response._cached ?? false,
...transformSearchResponse.pagination(response),
Comment thread
korgon marked this conversation as resolved.
...transformSearchResponse.results(response),
...transformSearchResponse.filters(response),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -848,9 +848,11 @@ export class AutocompleteController extends AbstractController {

// update the store
this.store.update(response);

const data: RenderSchemaData = { responseId };
this.config.beacon?.enabled && this.tracker.events.autocomplete.render({ data, siteId: this.config.globals?.siteId });
// @ts-ignore - _cached does not exist on type
if (!response._cached) {
const data: RenderSchemaData = { responseId };
this.config.beacon?.enabled && this.tracker.events.autocomplete.render({ data, siteId: this.config.globals?.siteId });
}
Comment thread
korgon marked this conversation as resolved.
Outdated

const afterStoreProfile = this.profiler.create({ type: 'event', name: 'afterStore', context: params }).start();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Product } from '@searchspring/snap-store-mobx';

export const CLICK_DUPLICATION_TIMEOUT = 300;
export const CLICK_DUPLICATION_TIMEOUT = 1000;
export const CLICK_THROUGH_CLOSEST_MAX_LEVELS = 12;

export const isClickWithinProductLink = (e: MouseEvent, result: Product): boolean => {
Expand Down
Loading