✅ Solved: View Model Triggers work inconsistently or not at all

I posted this as a comment, but felt it might be better to turn it into a post of its own to avoid it getting buried.

There’s definitely some weird stuff going on with this feature. Both in shared links as well as in the Rive editor (non-early access) and at runtime.

I’ll explain my findings as best I can, hopefully it’ll help resolve the issue. Issues seem to arise when trying to use the new View Model trigger functionality (awesome features by the way!).

In my use case, I wanted to update a number once a trigger was fired. It’s behaving differently in 3 environments:

  1. In the editor, it depends on whether it was fired from the current artboard and whether the State Machine is ‘doing something’:

    • If the trigger was fired from the current artboard, it always works.

    • If the same trigger was fired from a nested artboard, it depends on whether the State Machine is ‘moving’: If all layers of the State Machine are in a ‘paused’ state (no timelines playing), the number does not update.

    • Interestingly, if the trigger does more than just update a View Model Property (for example, if it initiates a transition in the State Machine), the number also updates.

  2. In shared links, the View Model trigger feature doesn’t seem to work at all.

  3. At runtime (tested in html/Javascript), it seems to almost work as intended:

An issue I’m facing across the board is that it seems to fire the trigger twice.

I’ve tried to build a demo that demonstrates all of the above:

vmtrigger-issues.rev

Inside you’ll find three ‘buttons’:

  • The left button fires a trigger from the main artboard.

  • The middle button fires a trigger from a nested artboard.

  • The right button also fires a trigger from another nested artboard, but this one initiates a State Machine transition.

Below the middle button there’s a “working” > “not working” indicator. This is a visual aid to show when Timeline 1 is still playing in Layer 1 of the State Machine. It will run for 3 seconds on Load. I added this because, in the editor, that button only works when a timeline is running.


I also made a simpler demo that may help to isolate the issues and doesn’t include any nested artboards:

vmtrigger-issues-simple.rev

From this one, I’m experiencing the following:

  • In the editor, the number updates twice, but only while a state machine timeline is running.

  • In a shared link, the number doesn’t update at all.

  • At runtime, the number always updates twice.


I tried to demonstrate both files in all three scenarios. Hope this helps to pinpoint and tackle the issues!

VMTrigger-issues-main.mp4


VMTrigger-issues-simple.mp4