Skip to content

Conversation

@evaporei
Copy link
Contributor

@evaporei evaporei commented Jul 14, 2022

After an entity merge, if the Entity Cache was cleared, the __typename
field would come up again and polute mappings and by consequence, the
POI. This PR fixes the issue/bug alongside with it's respective (new) test.

The merging behavior is described here in the docs (second item).

### Updating existing entities
There are two ways to update an existing entity:

1. Load the entity with e.g.`Transfer.load(id)`, set properties on the entity, then `.save()` it back to the store.
2. Simply create the entity with e.g. `new Transfer(id)`, set properties on the entity, then `.save()` it to the store. If the entity already exists, the changes are merged into it.

@evaporei evaporei self-assigned this Jul 14, 2022
@evaporei evaporei requested a review from leoyvens July 14, 2022 17:53
@evaporei evaporei force-pushed the eva/remove-typename-from-poi branch 3 times, most recently from 7131963 to 0e5117b Compare July 19, 2022 19:58
@leoyvens
Copy link
Collaborator

Nice work with the test!

evaporei added 8 commits July 25, 2022 08:54
The test scenario added here shows a bug in the EntityCache where the
__typename field wouldn't be cleared when it should.

This was affecting the POI and mapping code determinism, it will be
fixed in the next commit :)
After an entity merge, if the Entity Cache was cleared, the __typename
field would come up again and polute mappings and by consequence, the
POI.

This commit fixes the issue/bug alongside with it's respective test.
@evaporei evaporei force-pushed the eva/remove-typename-from-poi branch from 7b2e857 to 40b7e32 Compare July 25, 2022 11:57
@evaporei evaporei force-pushed the eva/remove-typename-from-poi branch from b2873fd to f629e90 Compare July 25, 2022 12:33
@evaporei evaporei force-pushed the eva/remove-typename-from-poi branch from 5652fa7 to b12a816 Compare July 25, 2022 15:09
@evaporei evaporei force-pushed the eva/remove-typename-from-poi branch from b10707c to a53d930 Compare July 25, 2022 15:17
@evaporei evaporei merged commit 7707967 into master Jul 25, 2022
@evaporei evaporei deleted the eva/remove-typename-from-poi branch July 25, 2022 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants