Skip to content

feat: Experimental plugin support [v0.50.0] #909

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

Open
wants to merge 36 commits into
base: 0.50
Choose a base branch
from
Open

Conversation

coolbueb
Copy link

@coolbueb coolbueb commented Aug 3, 2025

Summary of change

(A few sentences about this PR)

Related issues

  • Link to issue1 here
  • Link to issue1 here

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

Documentation changes

(If relevant, please create a PR in our docs repo, or create a checklist here highlighting the necessary changes)

Checklist for important updates

  • Changelog has been updated
  • frontendDriverInterfaceSupported.json file has been updated (if needed)
  • Changes to the version if needed
    • In package.json
    • In package-lock.json
    • In lib/ts/version.ts
  • Had run npm run build-pretty
  • Had installed and ran the pre-commit hook
  • Issue this PR against the latest non released version branch.
    • To know which one it is, run find the latest released tag (git tag) in the format vX.Y.Z, and then find the latest branch (git branch --all) whose X.Y is greater than the latest released tag.
    • If no such branch exists, then create one from the latest released branch.
  • If added a new recipe interface, then make sure that the implementation of it uses NON arrow functions only (like someFunc: function () {..}).
  • If I added a new recipe, I also added the recipe entry point into the size-limit section of package.json with the size limit set to the current size rounded up.
  • If I added a new recipe, I also added the recipe entry point into the rollup.config.mjs
  • If I added a new login method, I modified the list in lib/ts/types.ts
  • If I added a factor id, I modified the list in lib/ts/recipe/multifactorauth/types.ts

Remaining TODOs for this PR

  • Item1
  • Item2

porcellus and others added 22 commits January 16, 2025 00:52
…method and enhance error handling for plugin version mismatches and duplicates
# Conflicts:
#	lib/build/emailpassword.js
#	lib/build/emailverification.js
#	lib/build/genericComponentOverrideContext.js
#	lib/build/index.js
#	lib/build/multifactorauth.js
#	lib/build/multitenancy.js
#	lib/build/oauth2provider.js
#	lib/build/passwordless.js
#	lib/build/passwordlessprebuiltui.js
#	lib/build/session.js
#	lib/build/thirdparty.js
#	lib/build/totp.js
#	lib/build/version.d.ts
#	lib/ts/version.ts
#	package-lock.json
#	package.json
# Conflicts:
#	lib/build/emailpassword-shared5.js
#	lib/build/genericComponentOverrideContext.js
#	lib/build/utils.d.ts
#	lib/ts/utils.ts
#	package-lock.json
#	package.json
feat: Add init method support, better support for dynamic route handlers and added support for exporting logic from plugins
@coolbueb coolbueb changed the title feat: Experimental plugin support feat: Experimental plugin support [v0.50.0] Aug 3, 2025
return React.useContext(genericContext);
const contextValue = React.useContext(genericContext);

return { ...SuperTokens.getInstance()?.componentOverrides[key], ...contextValue };
Copy link

Choose a reason for hiding this comment

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

The code accesses componentOverrides[key] on the result of SuperTokens.getInstance(), which may return undefined. This creates a potential null reference exception when SuperTokens hasn't been initialized yet. Consider using SuperTokens.getInstanceOrThrow() instead, or add null checking with optional chaining:

return { ...(SuperTokens.getInstance()?.componentOverrides[key] || {}), ...contextValue };

This ensures the code handles the case when SuperTokens isn't initialized without throwing runtime errors.

Suggested change
return { ...SuperTokens.getInstance()?.componentOverrides[key], ...contextValue };
return { ...(SuperTokens.getInstance()?.componentOverrides[key] || {}), ...contextValue };

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@@ -87,7 +86,6 @@ export default class Passwordless extends AuthRecipe<
public readonly webJSRecipe: WebJSRecipeInterface<typeof PasswordlessWebJS> = PasswordlessWebJS
) {
super(config);
this.recipeID = config.recipeId;

PostSuperTokensInitCallbacks.addPostInitCallback(() => {
Copy link

Choose a reason for hiding this comment

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

Potential Bug: The line this.recipeID = config.recipeId; was removed, which might affect recipe identification. The recipeID property is declared in the base class and may need to be explicitly set from the config. Consider verifying that removing this assignment doesn't break the recipe identification logic, especially if there are cases where the static RECIPE_ID value isn't sufficient.

Suggested change
PostSuperTokensInitCallbacks.addPostInitCallback(() => {
PostSuperTokensInitCallbacks.addPostInitCallback(() => {
this.recipeID = config.recipeId;

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

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.

4 participants