# this.afterRefresh() is not a function

**URL:** <https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184>\
**Category:** Development\
**Created:** [November 12, 2019, 10:21am UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184 "2019-11-12T10:21:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![piratdavid](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@piratdavid](https://meta.discourse.org/u/piratdavid)\
**Post date:** [November 12, 2019, 10:21am UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184/1 "2019-11-12T10:21:29Z")

</div>

Hi! Long time since I looked over our plugins. After upgrading to 2.4.0 beta I encounter errors with uploading. The composer-editor.js class fails with “this.afterRefresh() is not a function”. To me it looks like this might be an old action in the ember Component class but I might be wrong. Finding nothing about it. Could this be some legacy or am I using deprecated code? Thanx

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [November 12, 2019, 10:54am UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184/2 "2019-11-12T10:54:57Z")

</div>

Do you have this issue in safe-mode ?

---

<div class="post-metadata">

**Author:** ![piratdavid](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@piratdavid](https://meta.discourse.org/u/piratdavid)\
**Post date:** [November 12, 2019, 12:58pm UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184/3 "2019-11-12T12:58:53Z")

</div>

It’s with my own plugins installed so running in [safe mode](https://meta.discourse.org/t/53504?silent=true) doesn’t help me find the issue. This particular plugin uses the composer-editor component in a template file.

I checked out v2.3.6 and searched for afterRefresh. It seems the composer-editor.js is using it differently. this.afterRefresh($preview); instead of this.sendAction(‘afterRefresh’, $preview); This at least seems to be the problem.

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [November 12, 2019, 1:01pm UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184/4 "2019-11-12T13:01:48Z")

</div>

It was unclear from your post if you were thinking it was coming from plugins or core.

Can’t help much without having access to code. But what you said is right `sendAction` is deprecated and shouldn’t be used anymore, actions are now simple closures.

---

<div class="post-metadata">

**Author:** ![piratdavid](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@piratdavid](https://meta.discourse.org/u/piratdavid)\
**Post date:** [November 12, 2019, 1:07pm UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184/5 "2019-11-12T13:07:40Z")

</div>

Allright, so just calling the action as a function is the correct way now? Then I guess I’ll have to look over my code. I thought maybe it was a bug.

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [November 12, 2019, 1:08pm UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184/6 "2019-11-12T13:08:58Z")

</div>

Yes calling it as a function should be the expected usage.

---

<div class="post-metadata">

**Author:** ![piratdavid](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@piratdavid](https://meta.discourse.org/u/piratdavid)\
**Post date:** [November 12, 2019, 1:42pm UTC](https://meta.discourse.org/t/this-afterrefresh-is-not-a-function/133184/7 "2019-11-12T13:42:51Z")

</div>

I hadn’t defined afterRefresh in the composer-editor tag parameters in the template file. I guess that is required.
