-
- Downloads
HOLI-9835: redesign API to fix client-side caching issue
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.
Showing
- README.md 3 additions, 4 deletionsREADME.md
- app/geo_api_client_test.ts 6 additions, 0 deletionsapp/geo_api_client_test.ts
- app/server.ts 44 additions, 3 deletionsapp/server.ts
- app/types.ts 14 additions, 1 deletionapp/types.ts
- app/voltastics_test.ts 12 additions, 2 deletionsapp/voltastics_test.ts
- app/volunteering_db.ts 60 additions, 25 deletionsapp/volunteering_db.ts
- app/volunteering_db_test.ts 182 additions, 62 deletionsapp/volunteering_db_test.ts
- deno.lock 3 additions, 0 deletionsdeno.lock
Loading
Please register or sign in to comment