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

[WIP] fix(lib): disable root form at beginning #115

Closed
wants to merge 3 commits into from

Conversation

maxime1992
Copy link
Contributor

CF #84

BREAKING CHANGE: If you have components that are extending one of the classes of ngx-sub-form AND that have an `ngOnInit` hook, they should call `super.ngOnInit()`

This closes #82
@maxime1992 maxime1992 added scope: lib Anything related to the library itself effort-1: minutes Will only take a few minutes to fix/create type: bug/fix This is a bug or at least needs a fix workaround-1: obvious Obvious workaround labels Nov 14, 2019
@maxime1992 maxime1992 self-assigned this Nov 14, 2019
@maxime1992 maxime1992 added the PR-state: WIP This PR is a work in progress label Nov 14, 2019
@maxime1992
Copy link
Contributor Author

⚠️ This PR is also branched off #113 and should be merged after that one ⚠️

@zakhenry
Copy link
Contributor

I think this could be simplified a lot and remove two observables:

  1. in setDisabledState, if the formgroup is falsy and isDisabled === true, set a boolean flag this.disabledBeforeInit on the class to true
  2. when the form is created
if (this.disabledBeforeInit) {
   formGroup.disable()
}

@maxime1992
Copy link
Contributor Author

It's a good idea. The thing I couldn't figure out is why I need the delay(0) here (or a setTimeout) :(

Note: It was broken before the MR introducing the use of ngOnInit

@maxime1992 maxime1992 added effort-2: hours Will only take a few hours to fix/create and removed effort-1: minutes Will only take a few minutes to fix/create labels Dec 17, 2019
@maxime1992
Copy link
Contributor Author

Closing in favor of #121

@maxime1992 maxime1992 closed this Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort-2: hours Will only take a few hours to fix/create PR-state: WIP This PR is a work in progress scope: lib Anything related to the library itself type: bug/fix This is a bug or at least needs a fix workaround-1: obvious Obvious workaround
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants