Fork me on GitHub
#fulcro
<
2019-12-31
>
currentoor02:12:58

sorry i have no idea about that

mping12:12:37

I'm trying to set up dynamic routing, but I'm hitting an error Invalid join, {:com. … g/current-route nil}"

mping12:12:47

It appears I missed some route configuration

mping12:12:10

all my router targets have only :ident and :route-segment configured

mping14:12:00

found out the problem, the components need a query on their definition

mdhaney18:12:39

Anyone else having issues with websocket server push? I’m getting an error at the Sente level about an invalid event when I try to do a server push. This is on latest Fulcro 3.1.1 and fulcro-websockets 3.0.5. I tested this when I first ported to F3 and it was working, but haven’t needed push until now and it’s not working for me.

mdhaney19:12:33

Ok, I found the problem. Not sure if this is a bug or intended behavior, but either way I’ll document it here in case others run into the same issue. Previously, I had been using the push function on the websocket component (through the WSNet protocol). To avoid a circular dependency, I had to switch to using the push function that’s injected into the parser environment. Here’s the issue (bug?) - those functions are not the same, and expect different arguments. The WSNet implementation converts the message into a single vector in a format that can be picked up and handled by the client networking, then passes this to the underlying Sente send-fn. However, the push function injected into the parser environment is the raw Sente send-fn itself, so if you use it you have to do the message formatting yourself. In my case this was easy enough because I handle push in a single place in my code, so I just had to do the message formatting there. @tony.kay I think at a minimum we should document this better. I would also argue that this might be a bug and that the push function injected into the parser env should work the same way as WSNet one, if for no other reason than the current implementation leaks the abstraction over send-fn and requires the user to use a special key in their code which is brittle (if that key ever changes). Unless you know of a particular reason someone might need the raw Sente send-fn. If you agree, it’s an easy change and I would be happy to send a PR with the fix.

tony.kay19:12:38

The wsnet protocol object is IN the env now, isn’t it? And it implements the WSNet protocol I thought

tony.kay19:12:42

Oh, I see, yeah, that :push key is misleading

mdhaney19:12:43

You’re right. And it does say the push fn in the environment is the same as the Sente send-fn. I must have missed that part when I first scanned the code.

tony.kay19:12:45

and if yoy use something like mount to create the websockets, you can access push via the protocol and that object directly, without using the env: https://github.com/fulcrologic/fulcro-websockets#connected-clients-and-server-push

mdhaney19:12:47

Yeah, it is a bit confusing. Maybe rename the key to send-fn, to make the distinction clear? But that would be a breaking change, so not sure it’s worth it.

mdhaney20:12:11

Yeah, I am using mount but had problems with circular dependencies. If you need to push in the context of a resolver/mutation, you pretty much have to use what’s injected into the pathom env. Because the WS component depends on the parser, which depends on your “model” namespaces containing resolvers/mutations, so they can’t depend on the WS component directly.

mdhaney20:12:31

But you’re right - using the WS component in the environment is the answer.