These are chat archives for canjs/canjs

18th
Dec 2018
Justin Meyer
@justinbmeyer
Dec 18 2018 02:17
It was a great day for open source today: https://twitter.com/canjs/status/1074850516092551168 Warms my heart to get help on DoneJS/CanJS/StealJS . Thanks @MarcGodard & @roemhildtg ! A great xmas present!
RyanMilligan
@RyanMilligan
Dec 18 2018 18:05
Hi everyone, I'm having another strange problem. We have an application using can-router to navigate the application. It works fine when just serving up my JavaScript folder using http-server, but if I run a steal build and host the result in a script tag (i.e., <script src="steal.production.js">), then the navigation doesn't work at all.

Here's how the router's being configured:

// route('', {app: 'admin', page: 'markets'})
// route('{app}', { page: 'markets' })
route('{app}/{page}', {app: 'admin', page: 'markets'})
route('{app}/{page}/{slug}')
route('{app}/{page}/{slug}/{action}')
route('{app}/{page}/{slug}/{action}/{actionTwo}')
route.start()

The commented out lines are things I removed while trying to troubleshoot this issue.

I also added this diagnostic code below it:

setInterval(() => {
    const result = route.matched();
    console.log(result); //-> ""
  }, 2000);

This is in Can 3, by the way. Anyway, when I navigate to #admin/markets when hosting the JavaScript directly, that console log outputs {app}/{page}, the view model properties get set as expected, and everything's fine. When I do the same thing in the built code, no view model properties get set at all, and it outputs undefined. It seems like the router isn't resolving the correct rule based on the hash I navigated to.

RyanMilligan
@RyanMilligan
Dec 18 2018 18:15
Oof, never mind, I figured it out. A vendor reverted a change I made a while ago to remove the can-route-pushstate module.