# עדכון ווידג'ט כאשר מתקבלת הודעה חדשה?

**URL:** <https://meta.discourse.org/t/update-widget-when-new-message-received/250637>\
**Category:** Development\
**Created:** [4 בינואר,‏ 2023,‏ 12:37am UTC](https://meta.discourse.org/t/update-widget-when-new-message-received/250637 "2023-01-04T00:37:52Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![piffy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/piffy/32/254198_2.png) [@piffy](https://meta.discourse.org/u/piffy)\
**Post date:** [4 בינואר,‏ 2023,‏ 12:37am UTC](https://meta.discourse.org/t/update-widget-when-new-message-received/250637/1 "2023-01-04T00:37:52Z")

</div>

I have a theme component widget that displays a little bubble when there is a New or Unread topic. To get it to update in real time I do this:

```
  topicTrackingState.onStateChange(() => {
    this.scheduleRerender();
   }); 

```

I would like to do something similar with PMs. I can use `new_personal_messages_notifications_count` to get the number of messages for a user. But if a new message is received the widget does not automatically rerender. Is there an easy way for me to update the widget on a new message being received similar to the topicTrackingState above?

---

_[View the full topic](https://meta.discourse.org/t/update-widget-when-new-message-received/250637)._
