These are chat archives for canjs/canjs

15th
Nov 2018
Chasen Le Hara
@chasenlehara
Nov 15 2018 01:11
@nmingneau Thanks for the issue. I whittled down the CodePen a little bit more. I’ll see if I can spend some more time on it tomorrow.
nmingneau
@nmingneau
Nov 15 2018 10:51
Does anyone know if there is a way to disable the logging in fixtures when they receive a call?
Justin Meyer
@justinbmeyer
Nov 15 2018 12:18
There is not. Easy to add. Why do you want it?
nmingneau
@nmingneau
Nov 15 2018 13:04
yes please, it takes a lot of space in my unit tests
Justin Meyer
@justinbmeyer
Nov 15 2018 17:50
@nmingneau can you create an issue to enable a fixture.log(false) ?

generally speaking, it will be as simple to add as finding these logs:

https://github.com/canjs/can-fixture/blob/master/core.js#L197

and wrapping them with a check if(fixture._log) { ... }
RyanMilligan
@RyanMilligan
Nov 15 2018 18:14

Has anyone seen an error like this before?

Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'http:/#admin/posts' cannot be created in a document with origin 'http://localhost:8080' and URL 'http://localhost:8080/#admin/posts'.

It's coming from can-route-pushstate. I'm trying to figure out why it's happening, but if anyone knows where to look and can save me some time, that would be great. The router works fine in this application in development mode, but throws that error when using steal.production.js.
Matthew Phillips
@matthewp
Nov 15 2018 18:17
@RyanMilligan you don't have a property named route on your viewModel do you?
RyanMilligan
@RyanMilligan
Nov 15 2018 18:23
Hrm, a very interesting question. On the app view model? Not that I see.
Matthew Phillips
@matthewp
Nov 15 2018 18:26
ok, that was a bit of a guess
I remember running into something like this and that was the problem
route is a semi-reserved word
RyanMilligan
@RyanMilligan
Nov 15 2018 18:27
I just did a search for route and I don't see any properties with that name. Just references to can-route.
RyanMilligan
@RyanMilligan
Nov 15 2018 18:37
We have app, page, slug, action, actionTwo and env.
RyanMilligan
@RyanMilligan
Nov 15 2018 18:49
And because it only happens when we build, it's very difficult to diagnose.
Matthew Phillips
@matthewp
Nov 15 2018 18:50
i saw something similar a while back and there was a loop occuring
ever time the route was set something in the route.data viewmodel was setting another property
I would check if something like that occurs
RyanMilligan
@RyanMilligan
Nov 15 2018 18:51
Hrm. I have logs on all the setters for the viewmodel properties and they're only getting called the one time.
Matthew Phillips
@matthewp
Nov 15 2018 18:52
hm, im out of ideas then
might have to debug within can-route
RyanMilligan
@RyanMilligan
Nov 15 2018 18:53
I'll add some more logs around can-route and see what I can figure out, thanks.
RyanMilligan
@RyanMilligan
Nov 15 2018 20:13
Ok, so I removed can-route-pushstate because I don't think we actually want it here, and that got rid of the error. But I still have an application that routes just fine when using steal.js and doesn't when using steal.production.js.
Matthew Phillips
@matthewp
Nov 15 2018 20:24
The only thing I can suggest is to start removing stuff and then add it back
RyanMilligan
@RyanMilligan
Nov 15 2018 20:24
I added some logging to setState, and both curParams and canRoute.data are just empty objects, which seems odd.
RyanMilligan
@RyanMilligan
Nov 15 2018 20:54
It looks like the problem was caused by can-route-pushstate. It's working now, and I think the only reason it wasn't working when I removed it was because I had some other troubleshooting stuff hanging around that was getting in the way.
Chasen Le Hara
@chasenlehara
Nov 15 2018 23:02
@RyanMilligan I’m glad you got it working. If you end up adding can-route-pushstate and running into the same issue, I’d be curious about what’s going on in these two places: 1) https://github.com/canjs/can-route-pushstate/blob/24dabe72b79acfcd30e516fc78599794d4f205b0/can-route-pushstate.js#L207 and 2) https://github.com/canjs/can-route-pushstate/blob/24dabe72b79acfcd30e516fc78599794d4f205b0/can-route-pushstate.js#L234
RyanMilligan
@RyanMilligan
Nov 15 2018 23:03
I actually put a log statement in that second one, so I can tell you the three arguments being passed were null, null, http:/#admin/posts. But I wasn't able to debug up the chain very well to figure out where that weird URL was coming from because it was a built bundle.
Chasen Le Hara
@chasenlehara
Nov 15 2018 23:16
Ok, gotcha. Very weird to see http:/#… how was only one slash added after the protocol 😅