Skip to content

Conversation

kmcginnes
Copy link
Collaborator

@kmcginnes kmcginnes commented May 12, 2025

Description

Apparently Jotai and Recoil treat family instances a little bit differently. In order to make sure we are getting cached versions of the family atoms I've added a deep equals comparer to the atom from lodash. This is only needed for the atomFamily instances that use arrays or objects as the parameter.

This stems from this bit of Jotai documentation:

To reproduce behavior similar to Recoil's atomFamily/selectorFamily, specify a deepEqual function to areEqual.

Validation

  • Simple smoke test as this is just a memory optimization

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0
    license.
  • I have run pnpm checks to ensure code compiles and meets standards.
  • I have run pnpm test to check if all tests are passing.
  • I have covered new added functionality with unit tests if necessary.
  • I have added an entry in the Changelog.md.

@kmcginnes kmcginnes force-pushed the jotai/atom-family-deep-equal branch from dea2f16 to cb8ef5a Compare May 13, 2025 23:44
Copy link

codecov bot commented May 13, 2025

Codecov Report

Attention: Patch coverage is 87.36842% with 24 lines in your changes missing coverage. Please review.

Project coverage is 32.88%. Comparing base (a899239) to head (cb8ef5a).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...h-explorer/src/core/StateProvider/displayVertex.ts 83.60% 9 Missing and 1 partial ⚠️
...src/core/ConfigurationProvider/useConfiguration.ts 80.48% 8 Missing ⚠️
...aph-explorer/src/core/StateProvider/displayEdge.ts 96.29% 3 Missing ⚠️
...graph-explorer/src/core/StateProvider/neighbors.ts 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #921      +/-   ##
==========================================
+ Coverage   30.72%   32.88%   +2.16%     
==========================================
  Files         525      523       -2     
  Lines       23627    21050    -2577     
  Branches     1408     1450      +42     
==========================================
- Hits         7259     6923     -336     
+ Misses      16241    14004    -2237     
+ Partials      127      123       -4     
Flag Coverage Δ
unittests 32.88% <87.36%> (+2.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kmcginnes kmcginnes force-pushed the jotai/atom-family-deep-equal branch from cb8ef5a to 3b6695d Compare May 27, 2025 22:38
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.

1 participant