Nova · Actions

Reset

reset gives a path back the value it had when the action was opened.

The action, as it is written
{
  id: 'reset',
  data: { greeting: 'Dear Ada' },
  layout: {
    component: 'Stack',
    children: [
      { component: 'Text', children: '$.greeting' },
      {
        component: 'Button',
        ref: 'change',
        children: 'Say hello',
      },
      {
        component: 'Button',
        ref: 'back',
        children: 'As it was',
      },
    ],
  },
  triggers: [
    {
      event: 'ui:click',
      ref: 'change',
      do: [{ set: 'greeting', value: 'Hello, Ada' }],
    },
    {
      event: 'ui:click',
      ref: 'back',
      do: [{ reset: 'greeting' }],
    },
  ],
}
Running herepress it

Dear Ada

What is done to it
press change
press back
What it then holds
{ greeting: 'Dear Ada' }
What it then says
Dear Ada
Say hello
As it was
Output matches the expected value

Left: the action as the package ships it. Right: the same action running in this page, rendered with this site’s components. Below: the action run as the example specifies, on the installed package.