Skip to main content

External Data Integration (infuseData)

The infuseData callback allows you to merge external data with entities fetched by Replyke. This is useful when your entities need additional information from external APIs or databases.

How It Works

When you provide an infuseData function to useEntityList, it:
  1. Receives the foreignId of each entity
  2. Fetches additional data from your external source
  3. Adds the external data under an infusion property
  4. Returns the combined data in the infusedEntities array
The original entities array remains unchanged, containing only Replyke’s data. External data is safely nested under the infusion property to prevent key conflicts.

Usage

Performance

  • Data is fetched once per entity and cached
  • Failed fetches return null and don’t block other entities
  • The infuseData function is called automatically when new entities are loaded

Use Cases

Product Inventory

User Profiles

Analytics Data

Error Handling

The infuseData function should handle errors gracefully:

Data Structure

External data is safely nested under the infusion property to prevent conflicts with Replyke’s entity properties:

Accessing Infused Data

Always access external data through the infusion property:

Handling Missing Data

Since external data fetching can fail, always use optional chaining: