# OnClick Navigate Event "Received event for missing view"

**URL:** <https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [February 28, 2024, 8:21pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541 "2024-02-28T20:21:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zachary\_Kacel1](https://avatars.discourse-cdn.com/v4/letter/z/ea666f/32.png) [@Zachary\_Kacel1](https://forum.inductiveautomation.com/u/Zachary_Kacel1)\
**Post date:** [February 28, 2024, 8:21pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/1 "2024-02-28T20:21:47Z")

</div>

I have a flex repeater that dynamically shows a view. In these views I have two clickable buttons. Each button navigates to a page and passes an ID parameter.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/4/04b8998c7fa55c3b0d69b882622b67bea0d81cec.png)

I have noticed when I navigate via the navigate action my error log fills up with the following error  
'`Received event for missing view "Project/Widgets/Machine@C$0:2[0]"`

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/b/eb4fdb7581b168ca18713ba5840439d2a990237f.png)

When I do the same thing via a script the error message does not appear.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8f2a8487b07b799e43ad529b81916e01fe76d8f1.png)

It's not a big deal to do everything with the script, but I am curious why the error happens with the navigate event.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 28, 2024, 10:17pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/2 "2024-02-28T22:17:26Z")

</div>

I don't get that error when I use a Navigation Action, so I highly suspect it's the result of something else. What Events do you have configured within the View being instanced within the Flex Repeater (other than the onClick)?

---

<div class="post-metadata">

**Author:** ![Zachary\_Kacel1](https://avatars.discourse-cdn.com/v4/letter/z/ea666f/32.png) [@Zachary\_Kacel1](https://forum.inductiveautomation.com/u/Zachary_Kacel1)\
**Post date:** [February 29, 2024, 2:24pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/3 "2024-02-29T14:24:27Z")

</div>

I have good amount of Bindings and one change script on the that view.  
But I have disabled all but the navigation action and still had the same effect.

---

<div class="post-metadata">

**Author:** ![Zachary\_Kacel1](https://avatars.discourse-cdn.com/v4/letter/z/ea666f/32.png) [@Zachary\_Kacel1](https://forum.inductiveautomation.com/u/Zachary_Kacel1)\
**Post date:** [February 29, 2024, 2:45pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/4 "2024-02-29T14:45:46Z")

</div>

Some of the key events are a Query Binding, an on Click Binding on the root and an on change for a `is_selected` parameter.

How my "Widget" works is when a user selects anywhere on the object in the flex repeater it highlights green to show which one is selected. It also has a table object in it that can be expanded to show all the tools loaded to that machine. The Tool Table gets it's data from a SQL binding in a custom property in my "Widget" view.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/b/eb559c5fbf79e1802d38cc9fd8d933830bd608fa.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 29, 2024, 4:09pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/5 "2024-02-29T16:09:02Z")

</div>

Change scripts are usually an area to look at, especially if they write to a property during their lifecycle. The script continues to execute on the back-end, but then when it tries to write to a property, that front-end property has vanished. Really though, anything in that View which writes to a property could be the culprit, if the write is part of some event which could still be executing while or after the navigation is performed. You might have a race condition in your View.

1. User clicks Open Machine link when the widget is not already selected.
2. Link onClick executes, which begins navigation - the first step of which is to remove the current View.
3. Widget onClick executes _after_ because the event has to bubble-up.
4. The Widget onClick attempts to write the highlight color to the Widget, but the Widget no longer exists because the View it lives in is gone.

---

<div class="post-metadata">

**Author:** ![Zachary\_Kacel1](https://avatars.discourse-cdn.com/v4/letter/z/ea666f/32.png) [@Zachary\_Kacel1](https://forum.inductiveautomation.com/u/Zachary_Kacel1)\
**Post date:** [February 29, 2024, 4:40pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/6 "2024-02-29T16:40:57Z")

</div>

Thanks I'll do some more digging and check these.

I should be able to disable all my scripts and binding and just turn them on one at a time until I find which one is causing the problem.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 29, 2024, 4:45pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/7 "2024-02-29T16:45:18Z")

</div>

Maybe. If it's a race condition, it might not happen every time. Welcome to the frustration of Quality Assurance. I wouldn't worry about plain bindings, but any change scripts, any Events which have Script Actions, and any binding _transforms_ could all be a cause.

---

<div class="post-metadata">

**Author:** ![Lynn\_Martineau](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@Lynn\_Martineau](https://forum.inductiveautomation.com/u/Lynn_Martineau)\
**Post date:** [October 10, 2024, 9:15pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/8 "2024-10-10T21:15:55Z")

</div>

I think it is a race condition.  
When I have a Navigate action as well as a script action, some of the scripted statements, specifically _`system.perspective.sendMessage`_ ends up without a source to be executed from and I get a Warning log "_Received event for missing view_ ".  
I think the intended receiver can't trust a message without a source so the message handler is rejecting the message.  
Changing the order of the script and the navigate actions doesn't make a difference.  
The fix is simple: delete the Navigate action and put _`system.perspective.navigate`_ at the end of the script. All of the scripted statements are executed before the navigate statement takes the parent view away.  
Ignition 8.1.43

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 10, 2024, 9:25pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/9 "2024-10-10T21:25:24Z")

</div>

> [@Lynn\_Martineau](#):
>
> I think it is a race condition.

It definitely is, made possible by how the events on perspective objects are executed.

> [@Lynn\_Martineau](#):
>
> Changing the order of the script and the navigate actions doesn't make a difference.

Correct, this makes no difference. While they are called in order, per the user manual:  
"However, Actions are not executed synchronously: sequential actions do not wait for any prior Actions to finish executing before running."

> **[Component Events and Actions | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/working-with-perspective-components/component-events-and-actions#perspective-events)**
>
> In Perspective, events and actions are some of the fundamental building blocks of project functionality. Actions give you the ability to respond to specific user inputs (such as mouse, keyboard, and touch inputs), as well as broad session events...

Including the navigation in your actual script action at the very end of the script is the only way you can ensure the script completes before you actually navigate.

---

<div class="post-metadata">

**Author:** ![Lynn\_Martineau](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@Lynn\_Martineau](https://forum.inductiveautomation.com/u/Lynn_Martineau)\
**Post date:** [October 10, 2024, 9:27pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/10 "2024-10-10T21:27:28Z")

</div>

yes, that is what I said.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 10, 2024, 9:37pm UTC](https://forum.inductiveautomation.com/t/onclick-navigate-event-received-event-for-missing-view/86541/11 "2024-10-10T21:37:24Z")

</div>

That's on me for poor wording, I was trying to explain **why** the race was happening and confirm that sticking the navigation at the end of the script is the only way to prevent the race condition.
