DButton no longer supports @action as a string. Please refactor to use an closure action instead

I’m using a theme based on the Feverbee theme, which has been in use for a number of years. Users have been in touch as they can no longer create new topics. The error message above is presented in the console.

Where can I find out how I need to adjust the template code to fix this deprecation issue? I’ve been through the forums to find how the d-button code should be modified but have not found anything relevant.

You can find detailed information about modern Ember actions here: Component State and Actions - Components - Ember Guides

But essentially, the message you’re seeing means that you need to change something like

{{d-button action="blah"}}

to something like:

{{d-button action=(action "blah")}}

If you can share a link or snippet of your code, I’m sure we can help out with some more specific instructions

7 Likes

Fantastic, thanks @david that fixed it for me. Is there somewhere I should start looking for information like this in future?

1 Like

In this case the error message you saw was supposed to provide enough information to fix the issue, but clearly that was not the case. We’ll bear it in mind for future changes, and try to provide more precise instructions. Thanks for raising the issue @pw3010

3 Likes

You can also look for best practice examples in core code on Discourse’s GitHub.

2 Likes

It’s a hint but the page that you linked doesn’t have the word “closure” on it. It’s like you have to actually know and understand javascript or something. Maybe a link to a page that explains it like you did? You could almost fit something like “change action=‘x’ to action=(action ‘x’)”.

I suspect I should know what a closure is, but I’ve still not found a way to make sense of all of javascript.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.