[Ur] RPC call line throwing error
Benjamin Barenblat
benjamin at barenblat.name
Wed Oct 25 22:33:19 EDT 2017
On Tue, Oct 24, 2017 at 7:56 PM, Nitin Surana <nsurana at usc.edu> wrote:
> I'll really appreciate if someone can help us. It shouldn't take more
> than a few minutes - https://github.com/urweb/urweb/issues/94
This took a bit more than a few minutes, and I'm still not entirely sure
what's going on, but I eventually figured out how to fix your particular
problem. I ran the compiler with the `-explainEmbed` flag, which gives
more information about errors like this, and got
Can't embed
loc: peers.ur:20:20-21:3
e: UNBOUND_1.Peers.A
t: FFI(Basis.client)
peers.ur:20:20: (to 21:3) Server-side code uses client-side-only identifier "Basis.mouseEvent"
So I tried changing your `onclick` handler to avoid capturing
`row.Peers.A` - i.e., I changed your `SELECT` statement to
SELECT Peers.C FROM peers WHERE peers.A > {[me]} OR peers.A < {[me]}
and it compiled.
This is definitely a case of a bad error message, but there may be more
in play here. It sounds like the compiler is trying to evaluate the body
of the `onclick` handler on the server instead of on the client, which
seems wrong to me. This may also be related to Ur/Web's apparent
inability to handle client IDs on the client side [1]. In any case,
though, if anybody else has experienced issues like this, please speak
up.
As an unrelated aside, you can simplify your `SELECT` statement further
- Ur uses `<>` as the inequality operator, so you can say
SELECT Peers.C FROM peers WHERE peers.A <> {[me]}
with the same semantics.
Best,
Benjamin
[1] https://github.com/urweb/urweb/issues/96
More information about the Ur
mailing list