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

onEnter is only called on '/' path #36

Open
jegarne opened this issue Dec 31, 2017 · 2 comments
Open

onEnter is only called on '/' path #36

jegarne opened this issue Dec 31, 2017 · 2 comments

Comments

@jegarne
Copy link

jegarne commented Dec 31, 2017

Is this intentional? Is the idea that you should build any state in the initial page load? Or would you add an onEnter method to all your components and call browse() on any store data they require. Admittedly I'm still getting my head around how this works.

Logging the branches variable from render.js to console looks like it only ever matches on '/'.

@jegarne
Copy link
Author

jegarne commented Dec 31, 2017

So this is actually not related to the path, onEnter does get called on the new components I added but only if I refresh the page, so it looks like this is related to the other bug "onEnter not called on client"

Update: yes, it does seem to be related to the paths. I renamed the path in src/config/routes.js from

{ path: '/', component: Home },

to

{ path: '/home', component: Home },

This appears to be what allowed to let onEnter be called on the other routes/components that I had added as maybe having a '/' route was somehow not letting them get called. Again, onEnter only gets run on the server, but that wasn't even happening on components other than the one mapped to '/' before.

@salembaira
Copy link

I confirm, onEnter is not isomorphic. It gets called server side but doesn't get called client side. I hope someone could make it really isomorphic.

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