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

Template onCreated before templates:forms package #101

Open
paulbalomiri opened this issue Mar 14, 2016 · 4 comments
Open

Template onCreated before templates:forms package #101

paulbalomiri opened this issue Mar 14, 2016 · 4 comments

Comments

@paulbalomiri
Copy link

Hi,
I think there is no clean way to install a created (or any other) hook before createFactory is called.
I thought about a PR, but in any way i think of it it's not backward compatible.

  • Use case: a template producing action,schema and data arguments from some collection and id template arguments.

Workaround for onCreated:

Template.form.onCreated ->
  ## some custom init
reactiveForms.createFormBlock
    template: 'form'
    submitType: 'normal'
Template.form.onCreated Template.created
delete Template.form.created

Is there any chance for the future to switch to using onCreate at register time, and announce the breaking chage?

@jonjamz
Copy link
Owner

jonjamz commented Mar 14, 2016

I'm confused about what you are trying to accomplish here. All you need to do to run your own created callback before the package's created callback is call onCreated before you register the template.

@paulbalomiri
Copy link
Author

Yes, i'm creating a lib, and want to be able to pass collection and id instead of schema and action.
In module.js Line 1360 and 1426 this package uses the deprecated template.created callback setter which runs before any onCreated callbacks.

So even when installing an onCreated callback before ReactiveForms.create(Formblock|Element) it is run only after the templates:forms callback.

@jonjamz
Copy link
Owner

jonjamz commented Mar 15, 2016

Ah. I thought I fixed that a long time ago. I guess I forgot!

I will publish an update soon with this fix.

@paulbalomiri
Copy link
Author

Just reminding you that this is a breaking change though 😄.

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

No branches or pull requests

2 participants