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

feat(form): allow to ignore init of existing fui modules inside form #2793

Closed
wants to merge 2 commits into from

Conversation

lubber-de
Copy link
Member

@lubber-de lubber-de commented May 21, 2023

Description

In case one wants to handle dropdown or calendar init after form init, this PR adds an optional ignoreModulesOnInit setting to support that.

Testcase

Selecting any value inside the dropdown must be clearable
https://jsfiddle.net/lubber/3pLrgvsa/1/

Closes

#2791

@lubber-de lubber-de added type/feat Any feature requests or improvements state/awaiting-reviews Pull requests which are waiting for reviews javascript Pull requests that update Javascript code labels May 21, 2023
@lubber-de lubber-de added this to the 2.9.3 milestone May 21, 2023
@mvorisek
Copy link
Contributor

mvorisek commented May 21, 2023

fomantic/Fomantic-UI-Docs#469 (comment)

I would prefer initChildModules (with true as default for BC) setting instead /w a console error when an uninitialized module is observed (when needed for some op).

Also, to fix #2791 fully, is it possible to emit a console error when a module is initialize more then once? (as as discovered in the issue, 2nd init setting is ignored and it implies a broken usage).

@lubber-de
Copy link
Member Author

This PR is obsolete as the main issue was fixed by #2794

@lubber-de lubber-de marked this pull request as draft May 21, 2023 19:14
@lubber-de
Copy link
Member Author

lubber-de commented May 21, 2023

I would prefer initChildModules (with true as default for BC) setting instead /w a console error when an uninitialized module is observed (when needed for some op).

I implemented that in the latest commit, however, as i recognized the basic issue was caused by dropdown rather than form, i dont think we should have the need to implement that setting anymore

Also, to fix #2791 fully, is it possible to emit a console error when a module is initialize more then once? (as as discovered in the issue, 2nd init setting is ignored and it implies a broken usage).

This would be needed inside every module and in some cases this possibly isnt an error (re-instantiating is possible by design).
However, you can simply adopt my attempt inside the last commit and check for a previous instantiation yourself.

let $element = $('.ui.dropdown');
     iWasInstantiatedBefore = $element.data('module-dropdown');

if (!iWasInstantiatedBefore) {
    $element.dropdown();
}

@mvorisek
Copy link
Contributor

This would be needed inside every module and in some cases this possibly isnt an error (re-instantiating is possible by design).
However, you can simply adopt my attempt inside the last commit and check for a previous instantiation yourself.

Thank you. If re-instantiating is by design and working properly, I agree this PR is not needed anymore.

@ko2in
Copy link
Member

ko2in commented May 22, 2023

@lubber-de Do I have to approve this PR?

I've understood that you've said we're not gonna need this implementation here and here.

@lubber-de lubber-de removed the state/awaiting-reviews Pull requests which are waiting for reviews label May 22, 2023
@lubber-de lubber-de removed this from the 2.9.3 milestone May 22, 2023
@lubber-de
Copy link
Member Author

@lubber-de Do I have to approve this PR?

No, i'll close this without merging and removed the "awaiting-review" tag

@lubber-de lubber-de closed this May 22, 2023
@lubber-de lubber-de deleted the ignoremoduleinit branch May 22, 2023 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code type/feat Any feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants