Skip to content

Conditions don't work in preview mode when not starting on the start page #1126

Description

@ziggy-cyb

Describe the bug
When testing a form in preview mode, if you start on a route that isn't in the main flow of the form, conditions won't fire the way they're supposed to.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new form
  2. Import the attached form json
  3. Preview page 2
  4. Click "Yes"
  5. form should route to page 3, but instead routes to page 4

Expected behavior
The form should route to page 3

Repository

  • runner

Desktop (please complete the following information):

  • OS: MacOS 13.4.1
  • Browser: Chrome
  • Version: 117.0.5938.132

Additional context
Here is the form JSON:

{
  "metadata": {},
  "startPage": "/first-page",
  "pages": [
    {
      "title": "First page",
      "path": "/first-page",
      "components": [],
      "next": []
    },
    {
      "title": "Summary",
      "path": "/summary",
      "controller": "./pages/summary.js",
      "components": []
    },
    {
      "path": "/page-2",
      "title": "Page 2",
      "components": [
        {
          "name": "jwjcCz",
          "options": {},
          "type": "YesNoField",
          "title": "Yes or no"
        }
      ],
      "next": [
        { "path": "/page-3", "condition": "fNIvrP" },
        { "path": "/page-4" }
      ]
    },
    { "path": "/page-3", "title": "Page 3", "components": [], "next": [] },
    { "path": "/page-4", "title": "Page 4", "components": [], "next": [] }
  ],
  "lists": [],
  "sections": [],
  "conditions": [
    {
      "displayName": "Yes or no is yes",
      "name": "fNIvrP",
      "value": {
        "name": "Yes or no is yes",
        "conditions": [
          {
            "field": {
              "name": "jwjcCz",
              "type": "YesNoField",
              "display": "Yes or no"
            },
            "operator": "is",
            "value": { "type": "Value", "value": "true", "display": "true" }
          }
        ]
      }
    }
  ],
  "fees": [],
  "outputs": [],
  "version": 2,
  "skipSummary": false
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions