Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix UI when adding categories to articles
Closes #481. The reason the UI was not refreshed was a regression introduced by cf550a0. Adding the argument "(statuses: $articleCategoryStatuses)" changes the key used by InMemoryCache from "articleCategories" to "articleCategories({"statuses":["NORMAL"]})". This results in cache.readFragment() (called in components/ArticleCategories/CategoryOption.js throwing this error: ``` Invariant Violation: Can't find field articleCategories on object { "id": ..., "text": ... ... "articleCategories({\"statuses\":[\"NORMAL\"]})": [ { "type": "id", "generated": false, "id": "ArticleCategory:...__...", "typename": "ArticleCategory" } ], "stats": [ ... ], "user": { ... } } ``` This commits solves this issue by forcing the key to be "articleCategories". The technique of using an @connection directive is documented here: https://www.apollographql.com/docs/react/data/directives/#connection
- Loading branch information