-
Notifications
You must be signed in to change notification settings - Fork 32
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
views.get_stats returns data in an old format #62
Comments
@julen please have a look into this. |
Quick update: I've looked through this today, and making the returned stats a list is straightforward. But there is a caveat. The client needs to merge the new stats data with existing UI data (there are some properties which are irrelevant to stats and are not part of the Another option I'm thinking about would be to make |
I'd just return exactly the same format of data as we do in browsing views. This should ideally simplify the code and help in the future to get rid of browser page reloads. That'd be step one. Step two is an ability to get short patch updates (in the future, via websockets), so we will need a mechanism to push partial data for specific keys. |
Okay, I'll try to match the format we use in browsing views. We'll need to have some plumbing code to be able to get all the context-relevant data. At the same time, I'm thinking that this won't be stats anymore, but rather something like browsing data, so we should probably rename |
Agree on renaming this to browsing data. |
Previously, cached data from Redis would be used as-is in views. This was the case both in the browsing view and the internal API endpoint to retrieve stats, which would be consumed by the client code directly. With the recent changes in the browsing pages, we changed the shape of the data used by the client, but we didn't adjust the internal asynchronous endpoint that retrieves updated stats when these are dirty. This commit not only fixes that inconsistency, but also enables the endpoint to return browsing-related data, not only stats. This data will be the same as the data provided in templates' context. Fixes serge-community#62.
When stats are requetsed via /xhr/stats/, they are returned in an old format (dictionary) whereas we now expect an array.
We need to change TreeItem.get_stats and CachedTreeItem.get_stats to match the new code.
Additionally, I'd suggest to look why we have code duplication in
TreeItem.get_stats
andCachedTreeItem.get_stats
How to reproduce:
Since the data will be stale, the page will start requesting stats data via XHR, and this data will come in a wrong format, causing errors in the console (because React components get data in an unexpected format).
The text was updated successfully, but these errors were encountered: