# Determine type of update in the panel update method

**URL:** <https://forums.creativeclouddeveloper.com/t/determine-type-of-update-in-the-panel-update-method/1013>\
**Category:** UXP Plugin API\
**Tags:** api-feedback\
**Created:** [July 8, 2019, 10:44pm UTC](https://forums.creativeclouddeveloper.com/t/determine-type-of-update-in-the-panel-update-method/1013 "2019-07-08T22:44:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Velara](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/velara/32/1278_2.png) [@Velara](https://forums.creativeclouddeveloper.com/u/Velara)\
**Post date:** [July 8, 2019, 10:44pm UTC](https://forums.creativeclouddeveloper.com/t/determine-type-of-update-in-the-panel-update-method/1013/1 "2019-07-08T22:44:20Z")

</div>

I’m running some possibly processor intensive events on update() and I want to run those events _only_ if there is a change to the artboard. Right now, if I simply change the selection the update method is called.

**Use Case**  
If the user moved an rectangle then I want to know that the document has changed. If the user simply selected a different rectangle then the document has not changed and I want to avoid running any specific operations.

```
async update(type) {
  if (type=="selection") updateUI();
  else if (type=="move"|| type=="delete" || type=="valueChange") {
     await exportDocument();
     updateUI();
  }
}
```

---

<div class="post-metadata">

**Author:** ![stevekwak](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/stevekwak/32/48_2.png) [@stevekwak](https://forums.creativeclouddeveloper.com/u/stevekwak)\
**Post date:** [July 9, 2019, 3:16pm UTC](https://forums.creativeclouddeveloper.com/t/determine-type-of-update-in-the-panel-update-method/1013/2 "2019-07-09T15:16:47Z")

</div>

Thanks for submitting this as a feature request. Currently, `update` function does not tell you what exact change has happened. While you can figure out what changed in your code mostly, we do understand it would be much easier if we provide the types. We will discuss this internally in the next feature request discussion session.

---

<div class="post-metadata">

**Author:** ![Velara](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/velara/32/1278_2.png) [@Velara](https://forums.creativeclouddeveloper.com/u/Velara)\
**Post date:** [December 15, 2022, 3:41pm UTC](https://forums.creativeclouddeveloper.com/t/determine-type-of-update-in-the-panel-update-method/1013/3 "2022-12-15T15:41:22Z")

</div>

I’m running into a case where I’d really need to support undo or redo OR show the history of events. Because I’m writing to pluginData there’s things that can easily break when the user uses undo or redo.

I might be able to minimize the issue if I can get and display the history events.

For example, I’d like to produce a history panel because right now if the user undos a few times they might revert from important changes.

Basically, I want to do this:

## History panel:

Create rectangle  
Resize rectangle  
Change border  
Group  
Property change description in my plugin ← important  
Property change description in my plugin ← important  
Move group  
Move group  
Move group  
Move group  
Move group  
Move group  
Add rectangle  
Change border

If the user undoes a bunch of times, in the example, let’s say he is undoing his design work, he might accidentally undo the plugin work as I have done many times.

I can see two feature requests.

- The full history API
- A smaller one that simply provides and array of history descriptions and their index so I can provide a basic history panel using the update method and then warn users if they are undoing the plugin changes they just made.

Even, more basic, an option to display notifications of what is being undone or redone when you use undo or redo.

I understand that it might not be possible in live editing mode. In a full API it could be a property and generate an error if called. In a basic API getting the changes shouldn’t affect anything. In fact it could have an additional property with the user name, “Bob resized rectangle”.
