-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Category label is not updated after adding one category #481
Comments
I want to fix the issue. |
Working on this.
To work around the problem, I suggest we always fetch all categories (remove statuses filter in query) and instead we change the display of categories according to whether the user is blocked and category status equals |
Closes cofacts#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
Eventually I found a simpler way to solve the problem; please have look at my PR 🙂 |
After adding a category, currently there is no any visual feedback that tells the user that the category is added.
Current workaround: refresh the whole page
Expected: UI should show that the category is added immediately (or shortly after API response)
The text was updated successfully, but these errors were encountered: