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

[v1] Notify config defaults and Invalid handler for event "click": got undefined #3722

Closed
smakinson opened this issue Mar 27, 2019 · 8 comments
Assignees

Comments

@smakinson
Copy link
Contributor

When I configure some defaults in quasar.conf for Notify, I see the following error in the console:

Notify config and Invalid handler for event "click": got undefined

and clicking the button does not dismiss the notification. I think I am reading the docs correctly about not needing to specify a handler to get the notification to close.

If a 'handler' is specified or not, clicking/tapping on the button will also close the notification

However, adding a handler to the defaults does not fix the error.

Software version

Quasar: beta 13
@quasar/app (v1+ only): beta 13
OS:
Node:
NPM:
Browsers:
iOS:
Android:
Any other software related to your bug:

I don't think I can create a codepen for this one, can I?

What did you get as the error?

In the console: Invalid handler for event "click": got undefined

What were you expecting?

No console error and the Notify close button to close the notification.

What steps did you take, to get the error?

Added this under config in quasar.conf:

 notify: {
   textColor: 'white',
   actions: [{ icon: 'close', color: 'white' }]
}

this also does not correct the issue:

 notify: {
   textColor: 'white',
   actions: [{ icon: 'close', color: 'white', handler: () => {} }]
}
@rstoenescu
Copy link
Member

Hi,

There is a limitation that you cannot specify functions under quasar.conf.js > framework > config.
If you need a function in your case (actions -> handler), then create a boot file where you import { Notify } from 'quasar' and use the Notify.setDefaults() method.

@smakinson
Copy link
Contributor Author

@rstoenescu I see. I don't actually need a function, I only tried adding it there to see if it prevented the console error. I see the console error with out the function in the config also. Should it be valid to use only the icon & color in the config? If so, am I reading the docs correctly that ( assuming the console error was not there ) by providing an action with an icon, it should close itself when the button is clicked? If not, using the setDefaults is cool, I just wanted to make sure this is definitely not a bug.

@smakinson
Copy link
Contributor Author

If I take the defaults out of quasar.conf and move it to

Notify.setDefaults({
    textColor: 'white',
    actions: [{ icon: 'close', color: 'white' }]
  })

I see the same error in the console.

Screen Shot 2019-03-28 at 9 04 24 AM

@rstoenescu
Copy link
Member

Isn't the outcome normal? You haven't defined your handler too.

Notify.setDefaults({
    textColor: 'white',
    actions: [{ icon: 'close', color: 'white', handler: .... }]
  })

@smakinson
Copy link
Contributor Author

Setting a handler does prevent the error when setting the defaults from Notify.setDefaults, but clicking the button does not close the notification.

Maybe its just the wording in the docs:

If a 'handler' is specified or not, clicking/tapping on the button will also close the notification

where is says specified or not that causes me to wonder if I was seeing a bug. I read that as specifying a handler is optional and if I don't it will still close the notification when the button it clicked/tapped. Might I just be misunderstanding that or should it be reworded? Sorry it could just be me.

@rstoenescu rstoenescu reopened this Mar 28, 2019
@rstoenescu
Copy link
Member

@pdanpdan Do you have a bit of time to investigate and see what's going on pls?

pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 28, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 28, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 28, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 29, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 29, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 29, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 29, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 29, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 29, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Mar 29, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 2, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 2, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 3, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 3, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 3, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 3, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 4, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 5, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 5, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 8, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 10, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 10, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 11, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 11, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 11, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 12, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 12, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 12, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 15, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 15, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 16, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 16, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 16, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 17, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 17, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 17, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 18, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Apr 18, 2019
@rstoenescu
Copy link
Member

Improved setting defaults through setDefaults method. Will be available in beta.18. I suggest you read the newly added section (Setting defaults) after this release.

@smakinson
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants