Skip to content

Conversation

ElliotFriend
Copy link

Hi, there!! Hope this isn't an unwelcome contribution.

The jotai functions currently display deprecation notices surrounding the use of several functions, especially those from jotai/utils.

fix #259

Motivation and Context

We use the @MetaMask/open-rpc-docs-react package for our Docusaurus site. Every time we build, there are many deprecation notices, just like is mentioned in issue #259. I've experimented with locally applying a patch to the package once downloaded, and the deprecation warnings disappear. This PR is a more "proper" form of that fix.

Description

This change migrates to the newer functions recommended by the deprecation notices. To accomplish this,

  • I've removed all imports from jotai/utils.
  • useAtomValue is now imported directly from jotai instead
  • useUpdateAtom (from jotai/utils) is replaced by useSetAtom from jotai.

How Has This Been Tested?

I've made the same changes to the node_modules version of this package in my local Docusaurus site, and the build proceeds with no deprecation notices.

I've also run the yarn test.prod script, and all tests pass. The functions I've used to replace the deprecated ones seem like drop-in replacements, and there shouldn't be any trouble. In this (old) commit in the jotai package, they're using these same functions "internally" for these deprecated functions I'm replacing.

I'm not sure if it's necessary to add error reporting or more test cases for a change this "simple," but I'm more than happy to add them if it's required.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

The jotai functions currently display deprecation notices surrounding the use of several functions,
especially those from `jotai/utils`. This change migrates to the newer functions recommended by the
deprecation notices.

fix stoplightio#259
@weyert
Copy link
Contributor

weyert commented Feb 12, 2025

Awesome work, I did a similar change in my other PR #260 but a separate PR for this jotai change is much better. Never found the time to work on it.

@ElliotFriend
Copy link
Author

Hey there, @SB-venkatyadavilli!! (Sorry to tag you blindly, but you're a recent committer)

I noticed my PR was a couple commits behind. I've gone ahead and merged the new changes into the branch, and the tests are still passing. Is there anything else that's needed before this PR can get reviewed?

Thanks!

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.

[Mosaic] deprecation notice from jotai
2 participants