jeescu / meteor-react-admin-lte

☄️ Starter project using Meteor + React and AdminLTE ui.
42 stars 18 forks source link

React Router or logic issue? #3

Closed gary-menzel closed 7 years ago

gary-menzel commented 7 years ago

I've just grabbed a copy of your admin template (to split out some admin tools from a recently deployed site).

I've added a couple of menu items with placeholder components - very easy to do.

However, I am noticing that any time I put in a specific route in the browser address bar (or just refresh a route that I am already viewing) that everything flows back through the home page and then back to the root dashboard route (/dashboard).

I have been using FlowRouter and am not familiar with React Router and wondered if there is something specific that I need to do to ensure an address navigates directly to that page (which is what happens with FlowRouter).

If this is a "feature" of React Router then I might have to switch it out (as it really interferes with the dev/reload cycle having to navigate back to the view component I am developing.

Maybe I have something else wrong, but I noticed it does it even if I am not using any additional view components.

But, still, it's a great Meteor/React wrapper around AdminLTE and I really like your component designs.

jeescu commented 7 years ago

Hi Sir @gary-menzel , It's probably the logic on index component import/s/ui/components/index.js. Just found the issue, will fix this asap. Thank you for finding out! :)

jeescu commented 7 years ago

@gary-menzel, Updates are pushed to master branch already. Here are some updates in summary:

NOTE: You don't need to use flow router on client for rendering views. This boilerplate is configured already using react router. See doc for more examples.

Please help to review and test these in your end. Happy coding!

gary-menzel commented 7 years ago

Thanks so much for looking into this. I'll grab a copy later today and update this issue once I have reviewed the changes.

gary-menzel commented 7 years ago

I took a look at your changes and, because they were minimal, I've made the changes in my own copy and confirm that it works perfectly. I have never used React Router before but can see exactly what was happening now. Your changes look similar to those recommended by Ryan Glover (on The Meteor Chef) for using React Router with Meteor.

In fact, just the browser history change in the dashboard component fixed the issue of it returning to the dashboard route all the time. The fix to the authentication is another good change.

I have a fairly large project that I am split into Public and Admin parts. I am glad that I can stay with React Router because Arunoda (who was behind Flow Router) has pulled out of Meteor development and I am not sure how long it will be supported.

In any case, "React Router" is probably more "standard" with a React-based application.

Thanks again for fixing it and I am happy to close this now.

jeescu commented 7 years ago

I'm glad. Thank you sir @gary-menzel for helping out!

Your changes look similar to those recommended by Ryan Glover (on The Meteor Chef) for using React Router with Meteor.

Yes! In fact, this is how commonly a react router's auth check should be done with react web apps.

In any case, "React Router" is probably more "standard" with a React-based application.

Yes!