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

Config ignores custom pasword component #719

Closed
hrubysi opened this issue May 17, 2023 · 1 comment
Closed

Config ignores custom pasword component #719

hrubysi opened this issue May 17, 2023 · 1 comment
Labels
🐛 bug Verified bug by team 🚀 release-ready Feature or fix is complete and on an upcoming release branch

Comments

@hrubysi
Copy link

hrubysi commented May 17, 2023

Reproduction

https://formkit.link/c75facd96647819d633fdc3e23695371

Describe the bug

I am unable to set custom input component to password globally.
Password always uses text input component.

See reproduction.

inputs: {
    text: createInput(TextInput),
    password: createInput(PasswordInput),
  }

Environment

• OS: Windows 11
• Browser Brave
• Version v1.51.114

@hrubysi hrubysi added ⛑ Needs triage The issue has not yet been examined by the FormKit team. 🐛 bug-report Bug is reported, but not verified by team labels May 17, 2023
@justin-schroeder
Copy link
Member

This does look like a bug indeed — so we’ll fix it in an upcoming release. That said, the issue here is that the text and the password input have the same schemaMemoKey because when they are not overridden in this way they share identical schema (the type is just a dynamic variable), so the schema is memoized and recycled for performance reasons.

When you re-assign an input like that you are actually performing a merge, not a wholesale replacement it actually merges the two definitions together. This is not intuitive, so I've published a fix on the @next tag that will make its way into 0.17.2 — however in the meantime we can just provide an alternative schemaMemoKey. Here’s your example working:

https://formkit.link/3873f7c9ceb49815bb653a1cd35baa55

@justin-schroeder justin-schroeder added 🐛 bug Verified bug by team 🚀 release-ready Feature or fix is complete and on an upcoming release branch and removed 🐛 bug-report Bug is reported, but not verified by team ⛑ Needs triage The issue has not yet been examined by the FormKit team. labels May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Verified bug by team 🚀 release-ready Feature or fix is complete and on an upcoming release branch
Projects
None yet
Development

No branches or pull requests

2 participants