dsuryd / dotNetify

Simple, lightweight, yet powerful way to build real-time web apps.
https://dotnetify.net
Other
1.17k stars 164 forks source link

Routing #161

Closed Elijah23Johnson closed 5 years ago

Elijah23Johnson commented 5 years ago

I have to say the first time I took a look at this library I was amazed and now that a few months has passed it looks even more amazing. I've been rewriting this project using dotNetify and I am running into a few issues. One in particular is the routing mentioned above. The first time the route is clicked it works fine however if i navigate away from that route and try to navigate back to it. Nothing... Also how would one go about passing props down to a routed component? Any Ideas?

Bundles path:

RouteRegistration this.RegisterRoutes("/", new List<RouteTemplate> { new RouteTemplate(nameof(Route.Home)) { UrlPattern = "", ViewUrl = nameof(Route.HomePage) }, new RouteTemplate(nameof(Route.HomePage)), new RouteTemplate(nameof(Route.LocationMainPage)) { UrlPattern = "locations", ViewUrl = nameof(Route.LocationMainPage) }, new RouteTemplate(nameof(Route.AboutUs)), new RouteTemplate(nameof(Route.ContactUs)), new RouteTemplate(nameof(Route.HotDeals)), new RouteTemplate(nameof(Route.Blog)), new RouteTemplate(nameof(Route.CustomerSupport)), new RouteTemplate(nameof(Route.FleetService)), new RouteTemplate(nameof(Route.FundRaiser)), new RouteTemplate(nameof(Route.SiteMap)), new RouteTemplate(nameof(Route.TermsOfUse)), new RouteTemplate(nameof(Route.PrivacyPolicy)), new RouteTemplate(nameof(Route.TireWarranty)), new RouteTemplate(nameof(Route.BigBrandCredit)), new RouteTemplate(nameof(Route.GoLearning)), new RouteTemplate(nameof(Route.Tires)), new RouteTemplate(nameof(Route.OilChange)), new RouteTemplate(nameof(Route.Brakes)), new RouteTemplate(nameof(Route.HeadAndTailLights)), new RouteTemplate(nameof(Route.Batteries)), new RouteTemplate(nameof(Route.SteeringAndSuspention)), new RouteTemplate(nameof(Route.Michelin)), new RouteTemplate(nameof(Route.Cooper)), new RouteTemplate(nameof(Route.Pirelli)), new RouteTemplate(nameof(Route.AllTireBrands)), new RouteTemplate(nameof(Route.AmericanRacing)), new RouteTemplate(nameof(Route.AtxSeries)), new RouteTemplate(nameof(Route.Helo)), new RouteTemplate(nameof(Route.Kmc)), new RouteTemplate(nameof(Route.AllWheelsBrands)), **new RouteTemplate(nameof(Route.AppointmentComponent)){ UrlPattern = "appointments", ViewUrl = nameof(Route.AppointmentComponent) },** new RouteTemplate(nameof(Route.History)), new RouteTemplate(nameof(Route.LoginInAppointments)), new RouteTemplate(nameof(Route.VisionStatement)), new RouteTemplate(nameof(Route.WholesaleLogin)), new RouteTemplate(nameof(Route.AvailablePositions)), new RouteTemplate(nameof(Route.ApplyNow)), new RouteTemplate(nameof(Route.CartComponent)) { UrlPattern = "cart" } }); The route in question is AppointmentComponent

dsuryd commented 5 years ago

The first time the route is clicked it works fine however if i navigate away from that route and try to navigate back to it. Nothing...

I'll need steps to reproduce. The dotNetify website uses the same routing system, can you point out the issue from there? Or create a small example I can run.

Also how would one go about passing props down to a routed component? Any Ideas?

There's no routing facility to directly send props down the component. Any info would need to pass down by adding variable to the URL pattern, e.g. chatroom/:chatid, which can then be accessed in the view model by implementing the OnRouted method.

Elijah23Johnson commented 5 years ago

@dsuryd thanks for the response. I am using the dotnetify libray as the frame work for our new website. Its a highly data driven site and everything is looking good so far with the exception of the above mentioned. There is a demo project you can download here https://drive.google.com/file/d/1QvwRypkxA9H9B3lVPgnV3BtQu41y7nP8/view?usp=sharing Please let me know if this helps in solving the problem. Once you get the site to load if you click on the link on top right called previous order then click the big brand logo to navigate home and once again try to click previous orders you will see what I am talking about. Also if you click the text on subnav called book appointment then navigate back to home and try to visit book appointment again that is another example of the same problem.

Thank you for the advice on the props I will definitely implement a work around for that. Do you plan to support it at some point? Specifically for props of type Object.

dsuryd commented 5 years ago

I ran your site. Routing doesn't work simply because of the pages have errors from missing components and view models.

image

Elijah23Johnson commented 5 years ago

Yes I just noticed that I was ripping unnecessary components out for the demo try this, I've removed all missing components. Apologies. https://drive.google.com/file/d/1QvwRypkxA9H9B3lVPgnV3BtQu41y7nP8/view?usp=sharing

Elijah23Johnson commented 5 years ago

Consequently it seems that the problem with the previous orders link resolved itself by scaling the app down and removing the console errors (Still present in main project with no errors). However the book appointments link is still experiencing no action on second visit. https://drive.google.com/file/d/1QvwRypkxA9H9B3lVPgnV3BtQu41y7nP8/view?usp=sharing

dsuryd commented 5 years ago

The zip was too big, took me a while to download the first time, so I wasn't going to do it again. With your first zip I cleaned up all the console errors by adding empty view models, removing missing React components and some other code in appointment unmount component that's causing errors. After that, both routing issues you mentioned were gone. As far as I'm concerned, the dotNetify's routing library is working as expected.

Elijah23Johnson commented 5 years ago

Thank you for your time investigating this. I will continue to develop the project. Paying more attention to the implementation to resolve these intricacy.

Elijah23Johnson commented 5 years ago

I would really like you to follow development with this project. So you can see how your library is put to use. I really hope it turns out to be what I'm hoping for. Thanks again for bringing it to us here is our beta url bbtalpha.azurewebsites.net you can find it here periodically until you will find it here www.bigbrandtire.com. I agree with you so far the library does what you say in the documentation. The only thing Im wondering now is can it handle complicated business logic.

dsuryd commented 5 years ago

I appreciate that you're using dotNetify for your development. I certainly hope that you will be successful and I will do my best to support you on issues that originate from the limitations or bugs in this library.

I think this particular issue thread can be closed as we have not identified any particular issue with the routing.