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

Hook function type definition is incorrect. #3722

Closed
gkamperis opened this issue Jun 21, 2023 · 3 comments
Closed

Hook function type definition is incorrect. #3722

gkamperis opened this issue Jun 21, 2023 · 3 comments
Labels

Comments

@gkamperis
Copy link
Contributor

According to this the hook functions return void

https://github.com/ngx-formly/ngx-formly/blob/bf89337a640749d01dfcf6b1ecc286adc7eb3c79/src/core/src/lib/models/fieldconfig.ts#LL243C55-L243C55

export type FormlyHookFn = (field: FormlyFieldConfig) => void;

onInit?: FormlyHookFn;

However, the below suggest otherwise

#2238 (comment)
https://github.com/ngx-formly/ngx-formly/releases/tag/v5.7.0

So, it looks like the type is incorrect and from the docs it is not clear which hook can return what.
Essentially we do not know if we can return an observable that will be auto unsubscribed or if we cannot return anything.

  • Formly version: 6.1.8
@gkamperis gkamperis added the bug label Jun 21, 2023
@aitboudad
Copy link
Member

Could you please please send a fix? We support returning an Observable for onInit hook.

@gkamperis
Copy link
Contributor Author

@aitboudad I could try but there is not enough info on how the architecture hangs together, what the parts are, etc etc.

Last time I tried to provide a simple solution that had no impact on architecture it was effectively rewritten as I clearly did not have any visibility on how things hang together and what would be alternative preferable approaches.

For something like this that affects public type declarations and changes in the API a lot more is required than just a fix.
How can I know if what I think is appropriate is acceptable?

There is just not enough documentation on the parts of the project so that someone can realistically provide good solutions.

Is there a way we can communicate more interactively? a chat of sorts?

@aitboudad
Copy link
Member

This issue has been fixed and released as part of v6.2.0 release.

Please let us know, in case you are still encountering a similar issue/problem.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants