Conversation
|
@rmorshea Let me know what you think about this implementation. This hook can alternatively be named
|
| if not categories: | ||
| return html.h2("Loading...") |
There was a problem hiding this comment.
Part of the reason for the data, loading, error pattern is that the if not categories check does not actually indicate whether the query is loading - it could be that there are no categories to show, that loading categories failed, or that categories are indeed loading.
You also need a convenient way to re-execute queries that are related. For example, triggering an add_categories database operation should cause the get_categories effect to re-run. Not only that, but other components that loaded data from the Categories model might need to update as well.
While this PR does allow people to use the ORM within their components, I don't think it makes it convenient to handle all the edge cases. I've drafted an alternative (#86) that follows in the style of Apollo.
This hook is best way I can think of developing ORM query support, at least in a way that Django developers would understand.
Potentially closes the following