# Command stack in viewer

**URL:** <https://forum.bpmn.io/t/command-stack-in-viewer/3166>\
**Category:** Developers\
**Created:** [February 24, 2019, 3:27pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166 "2019-02-24T15:27:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elia\_Rohana](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/e/e495f1/32.png) [@Elia\_Rohana](https://forum.bpmn.io/u/Elia_Rohana)\
**Post date:** [February 24, 2019, 3:27pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/1 "2019-02-24T15:27:42Z")

</div>

Hi,  
is it possible to use the command stack in the viewer .  
i developed many features in the modeler part, and i heavily used the commandStack because i liked the flexibility it provides, and the commandInterceptors(by the way - great work!!)

i was wondering why the command stack is not available in viewer, and is it ok to inject it manually in the viewer and use its abilities ??

Thanks  
Elia

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [February 25, 2019, 12:40pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/2 "2019-02-25T12:40:05Z")

</div>

> i was wondering why the command stack is not available in viewer

Could you elaborate on why you need editing support in the viewer (which is meant to be for _viewing_ only)?

---

<div class="post-metadata">

**Author:** ![Elia\_Rohana](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/e/e495f1/32.png) [@Elia\_Rohana](https://forum.bpmn.io/u/Elia_Rohana)\
**Post date:** [February 25, 2019, 3:00pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/3 "2019-02-25T15:00:02Z")

</div>

why command stack should be only for editing?  
command stack is generic enough to run any action, doesn’t matter if it is editing or not, at least that’s my perspective 🙂

anyway i added it to the extention module and it works

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [February 25, 2019, 6:27pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/4 "2019-02-25T18:27:41Z")

</div>

> [@Elia\_Rohana](#):
>
> command stack is generic enough to run any action, doesn’t matter if it is editing or not, at least that’s my perspective 🙂

Which actions are you composing on top of it that you’d like to use in the viewer?

---

<div class="post-metadata">

**Author:** ![Elia\_Rohana](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/e/e495f1/32.png) [@Elia\_Rohana](https://forum.bpmn.io/u/Elia_Rohana)\
**Post date:** [February 27, 2019, 7:56am UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/5 "2019-02-27T07:56:32Z")

</div>

custom actions  
such as changing visibility of a shape

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [February 27, 2019, 8:34am UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/6 "2019-02-27T08:34:03Z")

</div>

Thanks for the clarification.

I’m still not 100% sold on using the `CommandStack` in the viewer. But hey, I’m happy that you made it work 👍.

---

<div class="post-metadata">

**Author:** ![tim-kilian](https://forum.bpmn.io/user_avatar/forum.bpmn.io/tim-kilian/32/1217_2.png) [@tim-kilian](https://forum.bpmn.io/u/tim-kilian)\
**Post date:** [March 3, 2019, 12:02pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/7 "2019-03-03T12:02:16Z")

</div>

I see what you mean. The commandStack is analog to the eventBus and should be in the core, so its available for everyone. Now there is a huge dependency on modeling for a couple of modules, without defining that dependency in the depends section. Modeling makes no sense to me. I mean what is modeling for? Creating things, moving things, connecting things? It’s like a collection of that things, and should only define a collection without logic in it. Maybe I want a Viewer, who can bind things, but I have to include modeling, so it is a Modeler now? However, revertable actions should be in the core, not in modeling.

---

<div class="post-metadata">

**Author:** ![Elia\_Rohana](https://forum.bpmn.io/letter_avatar_proxy/v4/letter/e/e495f1/32.png) [@Elia\_Rohana](https://forum.bpmn.io/u/Elia_Rohana)\
**Post date:** [March 3, 2019, 12:32pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/8 "2019-03-03T12:32:06Z")

</div>

Hi Tim,  
i agree with every word! 🙂

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [March 4, 2019, 8:51am UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/9 "2019-03-04T08:51:27Z")

</div>

> [@tim-kilian](#):
>
> The commandStack is analog to the eventBus and should be in the core, so its available for everyone.

It is already available for everyone, it is simply not provided out of the box with every viewer.

To be clear:

- it has zero dependencies to `modeling`

- it can be included as easy as

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [March 4, 2019, 8:57am UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/10 "2019-03-04T08:57:38Z")

</div>

> [@tim-kilian](#):
>
> Now there is a huge dependency on modeling for a couple of modules, without defining that dependency in the depends section. Modeling makes no sense to me.

We are happy to file you in on how our toolkits work (and why they work the way they work). Please open a separate topic and clearly make your case regarding

- your use case
- what you’re trying to achieve
- what did not work (and how you expected it to work)

> [@tim-kilian](#):
>
> Maybe I want a Viewer, who can bind things, but I have to include modeling, so it is a Modeler now?

What exactly would you like to achieve? What would you like to _bind_? Let us continue the discussion in a new issue.

Thanks ☀

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [March 17, 2019, 7:16pm UTC](https://forum.bpmn.io/t/command-stack-in-viewer/3166/11 "2019-03-17T19:16:57Z")

</div>

Closed on March 17, 2019, 7:16pm UTC


