Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use more reliable comparison in deduping search results #6034

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

cngonzalez
Copy link
Member

Description

Since we moved the recent search results to a server-side service, we started seeing duplicate results in the global search results. The previous implementation, which stored search results in local storage, stringified recent searches before storing them and compared stringified new searches against them.

Since we switched to using a backend service, we could no longer rely on keys being in the same order. This PR uses the isEqual lodash method (used in many other places in the studio) to more reliably compare the values of the objects, rather than a string result.

What to review

The changed file. Any performance or other repercussions from using this comparison.

Testing

Tests already exist for this utility, but did not catch this because of mocking. A ticket has been created to better address this in the future.

Notes for release

Resolves an issue where the server-side storage of global recent searches was storing duplicate recent searches. Recent searches should now all be unique terms.

@cngonzalez cngonzalez requested review from a team and skogsmaskin and removed request for a team March 18, 2024 14:37
Copy link

vercel bot commented Mar 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Mar 18, 2024 2:49pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 18, 2024 2:49pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Mar 18, 2024 2:49pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Component Testing Report Updated Mar 18, 2024 2:47 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 32s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 11s 3 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 13s 4 2 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 33s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 3s 15 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 12s 6 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 20s 9 0 0

Copy link
Member

@skogsmaskin skogsmaskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cngonzalez cngonzalez added this pull request to the merge queue Mar 19, 2024
Merged via the queue into next with commit 1dd2ccc Mar 19, 2024
35 of 36 checks passed
@cngonzalez cngonzalez deleted the sdx-1191 branch March 19, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants