Skip to content

Commit

Permalink
fix(controller/search): addressing PR feedback to correct potential e…
Browse files Browse the repository at this point in the history
…rror
  • Loading branch information
korgon committed Dec 20, 2023
1 parent c66ae1d commit 33b917f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/snap-controller/src/Search/SearchController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ export class SearchController extends AbstractController {
// attempt to grab the element from storage if it is not provided
if (!element?.selector) {
const lastRequest = this.storage.get('lastStringyParams');
const storableRequestParams = getStorableRequestParams(JSON.parse(lastRequest));
const stringyParams = JSON.stringify(storableRequestParams);
const scrollMap: { [key: string]: ElementPositionObj } = this.storage.get('scrollMap') || {};
element = scrollMap[stringyParams];
if (lastRequest) {
const storableRequestParams = getStorableRequestParams(JSON.parse(lastRequest));
const stringyParams = JSON.stringify(storableRequestParams);
const scrollMap: { [key: string]: ElementPositionObj } = this.storage.get('scrollMap') || {};
element = scrollMap[stringyParams];
}
}

const scrollToPosition = () => {
Expand Down

0 comments on commit 33b917f

Please sign in to comment.