-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Remove RouteStore #335
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
Remove RouteStore #335
Conversation
[added] Router.PathState for keeping track of the current URL path [added] Router.RouteLookup for looking up routes [added] Router.Transitions for transitioning to other routes [added] Pluggable scroll behaviors [changed] <Routes preserveScrollPosition> => <Routes scrollBehavior> [removed] <Route preserveScrollPosition> [removed] Router.transitionTo, Router.replaceWith, Router.goBack
Conflicts: modules/actions/LocationActions.js modules/components/Routes.js modules/locations/HistoryLocation.js modules/locations/MemoryLocation.js modules/mixins/PathListener.js modules/stores/PathStore.js modules/utils/makeHref.js
Just wondering: did you deliberately use the older version of my code or is it by mistake? I've initially wanted to turn Locations to be action creators but then realized it's not at all neccessary, so my PR that you merged to master doesn't do it. I also made a hotfix that fixes regression I introduced in #326 but it's not merged yet. |
Ah, on a second look, I do see you've done it deliberately. Do you mind expanding why? My reasoning was that it's easier if Locations don't know anything about dispatcher, so they're injectable without making it public. However that makes Is there a safeguard for “action triggering another action” situation that I tried to fix with #332? (Example of regression: #334). |
The main reason I like Location objects to dispatch actions is because I want to pass the action
AFAICT the only time this is a problem is when you're using transition.abort/redirect in a sync transition (because the flux dispatcher is sync as well). We could handle this separately in the @rpflorence Perfect. Check boxes will help me to nail down everything that needs to work before we merge. Thanks! |
Alright, that's everything I found while auditing the examples |
added checklist to subject message |
Was thinking we could maybe fix #102 while we're at it. |
@gaearon Ah, I see. So you think that when imitating the browser |
Yes, I think this is the case. I'm not so sure about I also think that programmatic Finally, I chose to explicitly not handle |
I wanted to test this branch but I can't get it running because I can't seem to find a way to call I'm also wondering if problems with |
8b78703
to
4a4a18a
Compare
4a4a18a
to
637c0ac
Compare
Yes, that's correct. Since Also, this architecture makes it easier to contain things when rendering server-side, since there is no global object that directs traffic. I suppose we could still offer some helpers for triggering navigation actions, but they would be 1) client-side only and 2) limited to using full URL paths instead of the typical Thanks for your feedback about the scroll behavior BTW. I adjusted things to work as you suggested. Sorry I missed that in your original work. It should be in a usable state now. @rpflorence I believe I resolved all the bugs you found. I've run through the examples but can't find anything amiss. Care to give them one more run thru? |
This indeed looks correct now! Thanks @mjackson. I'd like to test-drive this PR on my project, and I'm actually happy with passing URLs to transitions, so if you could implement (1), I'd give it a spin! |
Also, removed deprecated static <Link> props.
@gaearon If you want to trigger transitions from your action creators, just keep a reference to the var routes = React.renderComponent(<Routes ... >, document.body);
routes.transitionTo('home'); |
This PR is a little messy (apologies) because I had to merge with @gaearon's changes that we merged into master, but it should preserve everything he did WRT scrolling behavior.
There may be a few bugs. Please run through the examples and let me know what you find!
@rpflorence checklist edit:
Router.transitionTo
is not a function (should probably just search all examples to fix these)partial app loading (while you're in there fix this maybe?! j/k we can worry about this later)