iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

Handle 404 better #1596

Open chrisbutler opened 6 years ago

chrisbutler commented 6 years ago

@marxo i reverted the devel branch, we can track this here and I can merge if/when there's a working solution

marxo commented 6 years ago

I tried both a fresh app (Meteor 1.6) and an existing app (1.5.2.2), both working properly with the package on this branch.

firefox_2017-11-11_02-06-28 firefox_2017-11-11_02-07-00

Is there anything specific required to replicate your case?

chrisbutler commented 6 years ago

@marxo ah, it's happening for me when the route is declared only on the client

that means there's potentially a significant behavior change here, since we don't explicitly require that all routes be declared in a shared space (https://github.com/iron-meteor/iron-router#routes-on-client-and-server)

marxo commented 6 years ago

@chrisbutler Yep, now I see it. Should controller.willBeHandledOnClient be true for client-side only routes? Specifically this one: https://github.com/iron-meteor/iron-router/blob/devel/lib/router_server.js#L78

marxo commented 6 years ago

@chrisbutler I'm looking at the middleware stack and as far as I can see when I move the route file to client I always get:

_handlersForEnv: { client: false, server: false }

in the dispatch call. However, when I move it to the shared space, I get

_handlersForEnv: { client: true, server: false }

for client routes.

Could this be a bug with the middleware stack? If I move the route definition to the server the route fails.