diff --git a/frontend/src/app/data-entry/episode-form/episode-entities-form/episode-entities-form.component.ts b/frontend/src/app/data-entry/episode-form/episode-entities-form/episode-entities-form.component.ts index c39a7c54..50541e3d 100644 --- a/frontend/src/app/data-entry/episode-form/episode-entities-form/episode-entities-form.component.ts +++ b/frontend/src/app/data-entry/episode-form/episode-entities-form/episode-entities-form.component.ts @@ -18,8 +18,7 @@ import { splat, differenceBy } from "@shared/utils"; import { ToastService } from "@services/toast.service"; type EntityPropertyName = 'agents' | 'gifts' | 'letters' | 'spaces'; - -const REFETCH_QUERIES = ['DataEntryEpisodeEntities']; +type EntityTypeName = 'AgentDescriptionType' | 'GiftDescriptionType' | 'LetterDescriptionType' | 'SpaceDescriptionType'; let nextID = 0; @@ -97,6 +96,16 @@ export class EpisodeEntitiesFormComponent implements OnChanges, OnDestroy { return keys[this.entityType] } + get entityTypeName(): EntityTypeName { + const types: Record = { + [Entity.Agent]: 'AgentDescriptionType', + [Entity.Gift]: 'GiftDescriptionType', + [Entity.Letter]: 'LetterDescriptionType', + [Entity.Space]: 'SpaceDescriptionType', + } + return types[this.entityType]; + } + ngOnChanges(changes: SimpleChanges): void { if (changes['entityType']) { @@ -173,7 +182,7 @@ export class EpisodeEntitiesFormComponent implements OnChanges, OnDestroy { id: episodeID, })); cache.evict(cache.identify({ - __typename: "AgentDescriptionType", + __typename: this.entityTypeName, id: entityID, })); cache.gc();