Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Dispatch router event actions #35

Open
marklagendijk opened this issue Jan 9, 2017 · 6 comments
Open

Dispatch router event actions #35

marklagendijk opened this issue Jan 9, 2017 · 6 comments

Comments

@marklagendijk
Copy link

marklagendijk commented Jan 9, 2017

I think this module would be more useful if we would change it in the following way.

  1. Rename the actions for go, replace etc to TRIGGER_GO etc.
  2. Dispatch actions for all the router events.

This way we can use the action methods for triggering any router actions. This is an extra way to trigger router methods, you can still use routerLink and or router.go etc.
We can use the RouterEvent actions to react to any router event, be it in a reducer, or using @Effect.

@marklagendijk marklagendijk changed the title Add router event actions Dispatch router event actions Jan 9, 2017
@brandonroberts
Copy link
Member

The main intent of this library is to keep your store in sync the Angular Router URL, since its the source of truth as to what's display on the page.

I'll look into adding the router events, but its also easy enough to map the router events into the store without adding them to this package.

@philipbulley
Copy link

Is it even appropriate to wrap/replicate the router.navigate functionality within this lib? Seems like its just a duplication of effort for very little gain (also thinking about #30). There's nothing wrong with using the Router API, right?

@llwt
Copy link

llwt commented Mar 15, 2017

@milkisevil I'm beginning to think the same thing. I'm currently running into an issue using the module with Nativescript where I need to call .navigate() on a module RouterExtensions instead of Router to support transitions.

Trying to think through how I stick with this pattern of emitting the go actions to navigate without replacing core functionality in this module and it's looking like it won't be possible.

@brandonroberts
Copy link
Member

The actions are provided so that your navigation can flow through your state. Also if you're using the devtools to debug and time travel through the state, those actions with trigger navigation along with your state changes.

There is going to be an update to this library that no longer uses router actions for navigation and takes a different approach to reducing the state during navigation. There will be breaking changes due to these changes. The repo is here for now https://github.com/vsavkin/router-store

@llwt
Copy link

llwt commented Mar 15, 2017

@brandonroberts Thanks for the quick response. That's great news!

@pjmagee
Copy link

pjmagee commented Jul 24, 2017

@brandonroberts so what would we now do in 4.X with router-store where I'm currently migrating but used go/back/forward?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants