Skip to content
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

JS/Frontend app.store multi response sets should be collections #5

Open
luceos opened this issue Feb 7, 2022 · 1 comment
Open

Comments

@luceos
Copy link
Member

luceos commented Feb 7, 2022

Feature Request

It would be great if we can make result sets collections. So that we not just get an array of objects, but also their respective meta data and possible helper functions.

Is your feature request related to a problem? Please describe.

The problem right now is that if you return meta information like pagination counts etc, this information is dropped while pulling objects from the store.

Describe the solution you'd like
It would be cool pushing the data into a collection that also supports meta information.

Justify why this feature belongs in Flarum's core, rather than in a third-party extension

Only core has a store and handles the api requests using app.request.

@askvortsov1
Copy link
Member

The find method currently returns an ApiResponse instance, which includes payload information. See https://github.com/flarum/core/blob/59dc3c26223350c8f96b78b896478d16e3be327a/js/src/common/Store.ts#L167-L167

I'm not sure how we could effectively store this in the store itself though. It would be a memory leak, as we would need to store this metadata for each request, and it's not clear when the data for any given request should be evicted.

@askvortsov1 askvortsov1 transferred this issue from flarum/framework Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants