Skip to content

JSON data adapter: support target-named keys (not just 'entities') #2

Description

@semanticintent

Enhancement

The JSON data adapter's ensureLoaded() currently expects either:

  • A bare array [...]
  • An object with an "entities" key: {"entities": [...]}

When using FORAGE tech_companies, the natural data shape would be:

{"tech_companies": [...]}

But this returns 0 results because data.entities is undefined.

Proposed fix: In ensureLoaded(target), check for data[target] before falling back to data.entities:

const entities = Array.isArray(data) ? data : data[target] || data.entities || [];

Found during: cal-tutorials EP01 setup.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions