Skip to content

fix(clerk-expo): Export useLocalCredentials from a submodule#3954

Merged
panteliselef merged 3 commits intomainfrom
elef/user-588-importing-any-hook-from-clerk-expo-will-require-expo-local
Aug 15, 2024
Merged

fix(clerk-expo): Export useLocalCredentials from a submodule#3954
panteliselef merged 3 commits intomainfrom
elef/user-588-importing-any-hook-from-clerk-expo-will-require-expo-local

Conversation

@panteliselef
Copy link
Contributor

@panteliselef panteliselef commented Aug 14, 2024

Description

Turns out that tree shaking does not work as expected, and when importing any hook into an app that does not have expo-local-authentication installed the app will break due to the missing dependency.

Before

import {  useLocalCredentials } from "@clerk/clerk-expo";

After

import { useLocalCredentials } from "@clerk/clerk-expo/local-credentials";

Updated Docs PR

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Turns out that tree shaking does not work as expected, and when importing any hook into an app that does not have `expo-local-authentication` installed the app will break due to the missing dependency.
@panteliselef panteliselef self-assigned this Aug 14, 2024
@changeset-bot
Copy link

changeset-bot bot commented Aug 14, 2024

🦋 Changeset detected

Latest commit: ccc03ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/clerk-expo Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@panteliselef
Copy link
Contributor Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @panteliselef - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 1.1.0-snapshot.v5f4676a
@clerk/backend 1.7.0-snapshot.v5f4676a
@clerk/chrome-extension 1.2.2-snapshot.v5f4676a
@clerk/clerk-js 5.15.0-snapshot.v5f4676a
@clerk/elements 0.13.1-snapshot.v5f4676a
@clerk/clerk-expo 2.2.0-snapshot.v5f4676a
@clerk/express 0.0.29-snapshot.v5f4676a
@clerk/fastify 1.0.31-snapshot.v5f4676a
@clerk/localizations 2.5.9-snapshot.v5f4676a
@clerk/nextjs 5.3.2-snapshot.v5f4676a
@clerk/clerk-react 5.4.2-snapshot.v5f4676a
@clerk/remix 4.2.15-snapshot.v5f4676a
@clerk/clerk-sdk-node 5.0.28-snapshot.v5f4676a
@clerk/shared 2.5.2-snapshot.v5f4676a
@clerk/tanstack-start 0.2.2-snapshot.v5f4676a
@clerk/testing 1.2.11-snapshot.v5f4676a
@clerk/themes 2.1.21-snapshot.v5f4676a
@clerk/types 4.14.0-snapshot.v5f4676a

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@1.1.0-snapshot.v5f4676a --save-exact

@clerk/backend

npm i @clerk/backend@1.7.0-snapshot.v5f4676a --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.2.2-snapshot.v5f4676a --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.15.0-snapshot.v5f4676a --save-exact

@clerk/elements

npm i @clerk/elements@0.13.1-snapshot.v5f4676a --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.2.0-snapshot.v5f4676a --save-exact

@clerk/express

npm i @clerk/express@0.0.29-snapshot.v5f4676a --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.31-snapshot.v5f4676a --save-exact

@clerk/localizations

npm i @clerk/localizations@2.5.9-snapshot.v5f4676a --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.3.2-snapshot.v5f4676a --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.4.2-snapshot.v5f4676a --save-exact

@clerk/remix

npm i @clerk/remix@4.2.15-snapshot.v5f4676a --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.28-snapshot.v5f4676a --save-exact

@clerk/shared

npm i @clerk/shared@2.5.2-snapshot.v5f4676a --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.2.2-snapshot.v5f4676a --save-exact

@clerk/testing

npm i @clerk/testing@1.2.11-snapshot.v5f4676a --save-exact

@clerk/themes

npm i @clerk/themes@2.1.21-snapshot.v5f4676a --save-exact

@clerk/types

npm i @clerk/types@4.14.0-snapshot.v5f4676a --save-exact

"@clerk/clerk-expo": minor
---

**Breaking**: Export `useLocalCredentials` from a submodule.
Copy link
Member

Choose a reason for hiding this comment

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

❓ Is it ok to introduce a breaking change in a minor release?

Choose a reason for hiding this comment

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

@anagstef , the breaking change was already released in 3663 as a minor release. This was presumably by accident, due to unexpected expectations of how tree shaking would work with metro. So, technically no, its not ok but its already done; but it wasn't intended to be breaking either.
This fix is the "correction" for that. If this 'fixes' the break, then the feature itself is indeed nonbreaking, so this would be a patch.

Copy link

@the-simian the-simian Aug 14, 2024

Choose a reason for hiding this comment

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

To be clear: this PR would be a patch and the feature would be ( once corrected ) a minor since its not an intentional breaking change requiring a migration, and doesn't deprecate any surface of the api.

If you must install the additional dependency still, then it would be a major change, because that is intentional feature addition requiring a migration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd have to agree that this is a breaking change, but it needs to be released as minor is order to fix a bug + introduces an API change.

@the-simian
Copy link

thanks for looking into this and responding so quickly to issue #3950, @panteliselef

@LauraBeatris
Copy link
Member

@panteliselef Awesome work 🏅

panteliselef and others added 2 commits August 15, 2024 19:33
Co-authored-by: Lennart <lekoarts@gmail.com>
@panteliselef panteliselef enabled auto-merge (squash) August 15, 2024 16:35
@panteliselef panteliselef merged commit 201be9b into main Aug 15, 2024
@panteliselef panteliselef deleted the elef/user-588-importing-any-hook-from-clerk-expo-will-require-expo-local branch August 15, 2024 16:47
brkalow pushed a commit that referenced this pull request Aug 22, 2024
Co-authored-by: Lennart <lekoarts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants