Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Delete action must remove references from other types #53

Closed
1 of 2 tasks
mersocarlin opened this issue Dec 18, 2017 · 0 comments
Closed
1 of 2 tasks

Delete action must remove references from other types #53

mersocarlin opened this issue Dec 18, 2017 · 0 comments
Labels

Comments

@mersocarlin
Copy link
Contributor

mersocarlin commented Dec 18, 2017

Assume post and comment entities and their schema definition as:

const commentSchema = new schemas.Entity('comments')
const postSchema = new schemas.Entity('posts', {
  comments: [commentSchema],
}) 
{
  entities: {
    comments: {
      'comment1': { ... }
    },
    posts: {
      'post1': {
        comments: ['comment1'],
        ...
      }
    }
  }
}

Make a DELETE request to /api/comments/comment1.

  • Store at comments is empty
  • Even though we re-fetch /api/posts, our store at posts['post1'].comments still contains comment1 reference
mersocarlin added a commit that referenced this issue Jan 3, 2018
jfschwarz pushed a commit that referenced this issue Jan 3, 2018
* (#53) Check whether arraySchema and entity schema belong to the same type

* (#53) Remove referenced props on delete action with same schema type

* (#53) Optimistic remove

* (#53) Handle self-referential schemas
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant