Change urls on Slider left and right
Closed this issue · 12 comments
@orballo I saw you started working on this as well. I also had a branch but you can continue with it.
I thinks the best way to approach this would be in the connection
package. I'd define an action and type called ROUTE_CHANGE_REQUESTED which gets type
and id
as arguments. Then, I'd do a saga listening for those actions which uses Router.push
from @worona/next/router
to change the url and has the same logic than the Link
component of connection
, retrieving the necessary permalink for the as
parameter from the state. Finally, in the saturn
theme, I'd use a saga to listen to all the ACTIVE_POST_SLIDE_CHANGED
and dispatch the ROUTE_CHANGE_REQUESTED
accordingly. For that, I'd include the postId
in the activePostSlideChanged
action.
Don't take into account my branch because I was about to implement this in a more complex way.
Actually, I wasn't working on this. My branch (change-slide) was created because, right now, when you open a post from PostList, it doesn't open that Post, but the one with the activeSlide
index that it's already in the store
. This is because the Link
component won't accept an onClick
callback, and there is where we were sending the action ACTIVE_POST_SLIDE_CHANGE_REQUESTED
.
That said, I can work on this issue as well. Just let me know if I should start with it.
Ok! Well, you can work on this then 😁
About that: Instead of sending an action, why don't you initialize the Slide on the correct post ID using the new getId
selector from the router?
Yep, I was thinking about how to make it render properly the first time, without changing the index. I'll try that.
I'm going to start working on this issue, but I don't understand why do you want me to create an ROUTE_CHANGE_REQUESTED
on connection
if there is already one in router
. Can I not use that one?
Maybe I'm looking somewhere else but:
So far, with those actions, I've got the route change working, but it breaks when slides are passed too fast.
@orballo what's still not working here?
@luisherranz It's working, but the actions are sent when the animation starts, so the animation is not fluid.