Skip to content

[Bug]: paneldynamic self-referential binding overwrites network array data with numeric value #194

Description

@ihsankahveci

Describe the bug

The non_family_network paneldynamic element in survey.json has its bindings.panelCount set to "non_family_network" — the same name as itself. This creates a two-way binding conflict: SurveyJS updates the bound variable with the current panel count (a number), which then overwrites the array of person objects stored under the same key. As a result, 28 survey records in MongoDB have a numeric value (1–7) in non_family_network instead of the expected array of person objects.

Root cause

{
  "type": "paneldynamic",
  "name": "non_family_network",
  "bindings": {
    "panelCount": "non_family_network"   // ← self-referential
  }
}

When a respondent enters a network size (e.g. 3), non_family_network is initially set to 3 via the binding. As panels are filled in, SurveyJS stores the array of person objects under the same key. However, under certain navigation patterns (back/forth, partial completion), the numeric panelCount value races with the array value, and the number wins — permanently corrupting the record.

Steps to reproduce

  1. Run npm run dev in client/
  2. Navigate to the Network Module in a survey
  3. Enter a number (e.g. 3) for "how many people do you closely know..."
  4. Advance to the next page — 3 panel tabs appear
  5. Fill in some person details, then navigate back to the network size page
  6. Navigate forward again to the paneldynamic page
  7. Complete and submit the survey
  8. Check MongoDB — non_family_network may contain 3 (a number) instead of an array of 3 person objects

Expected behavior

non_family_network (now renamed to network_list) should always contain an array of person objects, never a bare numeric value. The panel count binding should reference a separate variable so the count and the array data never collide.

Relevant log output / screenshots

# Example corrupted MongoDB document (anonymized)
{
  "non_family_network": 3,        # ← should be [{...}, {...}, {...}]
  "non_family_network_size": "3"  # ← correct
}

# 28 records affected across the kc-pit-2026 deployment

Software version

kc-pit-2026 (commit 440fa18)

Environment

Other (specify below)

Other environment details

Azure Web Service — production deployment. Bug is in the SurveyJS JSON configuration, platform-independent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions