Open ianplatt555 opened 3 years ago
cc: @zth @n1ru4l who have mentioned related work before in https://github.com/facebook/relay/pull/3148
Also @Blitz2145 who asked a similar question on GraphQL discord.
I think this is kind hard to do since you need to iterate over entire store and remove that refs.. Another thing is what will happen with UI in case it lost reference.. In case it is null there is no action...;
@damikun With the right data structures iterating over the entire store could be avoided. In case there is null you trigger a runtime exception if an edge is not expected to be null. Not automatically removing it enforces components that use mutations to be aware of the other components that are rendered on the screen and introduce a tight-coupling which the relay framework approach actually discourages doing.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Seems there's another merged PR that somewhat addresses this issue? https://github.com/facebook/relay/pull/3177 From connections at least
Looks like this bug is still present, and it is super counter-intuitive and hard to debug.
Version: v12.0.0
@deleteRecord
does not properly remove references to the record from other places in the store such as inside connections and lists. It instead turns them all into dangling null references. This seems like a bug because why would you ever want to leave those nulls hanging around referencing records that no longer exist?