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(elements): Errant renders upon sign-in completion #4225

Draft
wants to merge 11 commits into
base: tm/elements-consolidation
Choose a base branch
from

Conversation

tmilewski
Copy link
Member

Description

TODO

Fixes SDKI-144

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:

@tmilewski tmilewski self-assigned this Sep 25, 2024
Copy link

changeset-bot bot commented Sep 25, 2024

⚠️ No Changeset found

Latest commit: aa8e5f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@@ -146,34 +144,28 @@ export default function SignInPage() {
<CustomProvider provider='google'>Continue with Google</CustomProvider>
</div>

{continueWithEmail ? (
Copy link
Member Author

Choose a reason for hiding this comment

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

Just cleaning this up.

@@ -426,7 +410,11 @@ export const SignInRouterMachine = setup({
},
'FORM.ATTACH': {
description: 'Attach/re-attach the form to the router.',
actions: enqueueActions(({ enqueue, event }) => {
actions: enqueueActions(({ context, enqueue, event }) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Ensuring we don't attach a new formRef, and ultimately re-render, if it's not necessary.

enqueue.raise({ type: 'NEXT', resource: event.output });
}),
resetResource: assign({ resource: ({ context }) => context.clerk.client.signIn }),
setResource: assign({
Copy link
Member Author

Choose a reason for hiding this comment

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

Rely on the returned SIA resource, over client.signIn

@@ -1,5 +1,5 @@
import { useClerk } from '@clerk/shared/react';
import { useClerkHostRouter } from '@clerk/shared/router';
import { useClerkHostRouter, useClerkRouter } from '@clerk/shared/router';
Copy link
Member Author

Choose a reason for hiding this comment

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

Use useClerkRouter hook from shared vs the original local implementation.

}, [clerk, exampleMode, formRef?.id, !!router, clerk.loaded]);
}, [Boolean(clerk), exampleMode, !!router, clerk.loaded]);

useEffect(() => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Limit the number of events sent by scoping the dependencies down.

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.

2 participants