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

How do you re-render? #1

Closed
seanhess opened this issue Nov 25, 2014 · 9 comments
Closed

How do you re-render? #1

seanhess opened this issue Nov 25, 2014 · 9 comments

Comments

@seanhess
Copy link

I'm getting this all working together right now, thanks for the example!

How do you re-render when a immstruct changes with this integration?

Thanks,
~sean

@seanhess
Copy link
Author

Got it working! New version of react-router is much easier to work with than the last. I'd recommend updating this repo with something canonical.

https://gist.github.com/seanhess/2925452e7f0bf29865d2

@torgeir
Copy link
Member

torgeir commented Nov 25, 2014

You don't, yet ;)

just started looking into this myself, and things seem to have changed remix-run/react-router#28

PRs welcome!

@torgeir
Copy link
Member

torgeir commented Nov 25, 2014

Alright, nice. Had a go somewhat similar to yours, and that seems to work quite nicely!

Though personally I think I'd prefer the previous versions' approach by passing individual props to different Routes.

Currently all routes would have access to one shared state. Making things work by splitting the state up seem unnecessarily difficult, and needs some wrapper react component that closes over a cursor, much like with your 'page()' function, but it seems we'll have to live with that:)

Can multiple routers coexist within a single page?

@torgeir
Copy link
Member

torgeir commented Nov 26, 2014

Does this really work like you'd intend? If you pass

<Handler one={state_one} two={state_two}/>

https://gist.github.com/seanhess/2925452e7f0bf29865d2#file-omni-react-js-L86

all your components have one and two on their props

@seanhess
Copy link
Author

I don't know how else to do it. Are there other options?

On Wed Nov 26 2014 at 12:08:33 PM Torgeir Thoresen notifications@github.com
wrote:

Does this really work like you'd intend? If you pass

https://gist.github.com/seanhess/2925452e7f0bf29865d2#file-omni-react-js-L86

all your components have one and two on their props


Reply to this email directly or view it on GitHub
#1 (comment)
.

@torgeir
Copy link
Member

torgeir commented Nov 26, 2014

Oh, you're right, I didn't think this through. Here's an updated example with different cursors (that could reside in different immstructs), and passing route-data as statics

https://github.com/omniscientjs/react-router-omniscient-example/blob/master/index.js

@torgeir
Copy link
Member

torgeir commented Nov 27, 2014

omniscient/issues/25 moved here:

Hmm. Having to switch the cursor based on the url feels really broken to me. Is there any way to specify the cursor on the route definition?

Or maybe there's some way to let the page components choose their own
cursor.

That was merely an example to show it's possilble pass different cursors to different components based on what's rendered.

Here's how react-router suggest you handle async data. A similar approach ought to work with async/cursors as well

@mikaelbr
Copy link
Member

mikaelbr commented Feb 8, 2015

Did we ever conclude this? Closable? cc @torgeir

@torgeir
Copy link
Member

torgeir commented Feb 8, 2015

Well, we got the example repo. It's clumsy, to say the least, with the latest react router api not taking handler props, could prob need more experimentation

@torgeir torgeir closed this as completed Feb 8, 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

3 participants