Routing a 404 page

If I include a default case in the index.stache routing switch, that default component loads and is shown for a brief second, then the desired case loads and replaces it. I can prevent this by removing the default, but that’s how we were getting a 404 page to show on invalid routes. What is the correct way to do get 404 pages?

What I am currently doing

    {{#switch page}}
      {{#case "home"}}
        <can-import from="./app/home/home" can-tag="app-loading">
          <app-home/>
        </can-import>
      {{/case}}
      {{#default}}
        <can-import from="./app/page/404.component" can-tag="app-loading">
          <page-404 />
        </can-import>
      {{/default}}
    {{/switch}}

How are you setting the value for your page property? If the default case is showing, that suggests your problem may be that the template you have above is being rendered before the page property is set to "home".

That could be fixed by setting page sooner or delaying this portion of the template from rendering until page has resolved.

Bitballs does 404s: https://donejs.com/bitballs.html#section=section_404s