Skip to content
  • Daniel Bimschas's avatar
    HOLI-9835: redesign API to fix client-side caching issue · 38783d40
    Daniel Bimschas authored
    On client side, Apollo client normalizes caches. Because an entity returned by this API can be
    contained in multiple query results (`engagementById`, `engagementRecommendations`, ...) the entity
    contained therein must always be of the same shape. Otherwise, this can lead to client-side cache
    updates resulting in unexpected UI updates.
    
    This commit introduces the type `EngagementReco` as an envelope around the actual
    `Engagement` entity. `EngagementReco` additionally contains the query-specific fields
    `matchedTopics`, `matchedSkills` and `matchedGeoLocationDistanceInMeters`.
    
    To be backwards-compatible
    
    * the current `engagementRecommendations` query continues to
      return the current shape of data
    * the newly introduced `engagementRecos` returns items of the new
      `EngagementReco` with the aforementioned match fields "removed" from the `Engagement` entity (undefined)
    
    Clients must upgrade to `engagementRecos`. Thereafter, `engagementRecommendations` can
    be removed and the `matched*` fields within the `Engagement` type as well.
    38783d40