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

Batched fetching #33

Closed
petehunt opened this issue May 7, 2014 · 3 comments
Closed

Batched fetching #33

petehunt opened this issue May 7, 2014 · 3 comments

Comments

@petehunt
Copy link

petehunt commented May 7, 2014

If I nest a Person inside of a Movie, there are going to be 2 serial fetches (which discourages composition due to the perf hit).

Instead, if getDataUrl() were a static function of the route (rather than an instance method of the props) it could be called recursively before the components are rendered so you can fetch all of the data you need to.

@ovidiuch
Copy link
Member

ovidiuch commented May 7, 2014

Interesting idea. It would be even cooler if the API could support more than one request in a HTTP connection (something like django-superbulk).

But I'm not sure how you can trace all the components to be loaded all the way from the root component to the tree leaves. The component props can either come from an already fetched and parsed request or from the DOM, which is hardcoded inside the render method.

@ovidiuch
Copy link
Member

ovidiuch commented May 7, 2014

A similar but reversed idea that I've been thinking about is for generateSnapshot to nest all the composed component props recursively. This has two benefits. 1. You can persist the entire state of a component including its children and it all will be loaded without the need of any request. 2. The cached history entry will also contain the entire nested props/state which will again render all the current hierarchy of components in a blink when going back in history.

@ovidiuch
Copy link
Member

ovidiuch commented May 9, 2015

As honored as I am for having an issue opened by @petehunt, this is no longer relevant as the Cosmos project evolved into something that supports React components instead of dictating their design (besides the need to be encapsulated).

Pete–whatever you may be doing at the moment, if you ever get another chance to check out the new project mission feel free to check out the (simplified) README: https://github.com/skidding/cosmos/blob/master/README.md

@ovidiuch ovidiuch closed this as completed May 9, 2015
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