-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using "client" keyword breaks todo list example #154
Comments
The same thing happens with todo-db.links if |
@Emanon42 has started to look at this issue. We're not entirely sure what the best solution is, just looking at it. As has been alluded to in various issues, the problem arises because web pages are now generated on the server prior to being delivered to the client. If, during page generation on the server, a call to a (My guess is that this is a Fixing this issue is quite tricky; I'm not entirely sure what the best way forward should be. Here are a few ideas:
I think this has some parallels with some of the issues we've seen with query policy mismatches (c.f. #835), which are currently detected dynamically. I'd be grateful for any input -- what would people prefer? |
Do option 1 first. It is the least invasive option and I reckon it would yield immediate success. It is also easy to replace later with a more sophisticated solution, if we decide that is what we want. Option 2 is just silly. Option 3 would require more careful design. Simply adding a |
Seems sensible. I agree that #3 certainly would need a more careful design. |
It seems like dynamically ruling this out could also rule out lots of things that currently do work. But maybe we should just try it and see. It would help to have a clear (and minimal) example illustrating the same problem, which we could use to differentially debug comparing what happens with and without the client keyword. |
I am not sure what you are hinting at here. Currently we do enforce dynamically that one cannot use a client side function during page generation, it just so happens to yield an extremely unhelpful error. |
Having looked at it further, I'm fairly sure we can rule this behaviour out at runtime by checking whether |
Whatever you decide to implement make sure it is toggleable, i.e. guarded by config/commandline flag. |
Seems like a routine bug fix rather than a feature to me - is a flag really necessary? |
@dhil sorry, that was a bit oblique. I meant that simply failing if we ever try to call the client from the server is way too strict. But I guess that wasn't what anyone meant. The "error message" is just an XHR response to a request that doesn't exist; there is no Links code that checks for this error condition. What @SimonJF suggests, checking some server-side state to determine this, seems like the right (dynamic) thing for now. |
I guess you are right if you are going with Option 1 then I agree no flag is necessary. I was thinking about the other options. |
* Fix links-lang#154 by checking for ajax request data
If you try to run the todo list example using the appserver (todo.links.txt) then the presence/absence of the "client" keyword on the "todo" function seems to determine whether the program works correctly. If the "client" keyword is used then the page renders as a line or so of gobbledegook, if it is omitted then everything is fine.
I don't know whether this is a bug in the interpreter (i.e. client calls should be allowed in server page handlers and aren't handled correctly) or in the typechecker (i.e. client calls shouldn't be allowed in server page handlers but this isn't being checked). It is also not clear to me whether this is related to the appserver at all, as opposed to realpages or something else.
This is observed with Links 0.6.1. I'm guessing that someone (Sam) ran into and avoided this problem when updating todo.links, so perhaps it duplicates an already-known bug, but here's the issue if not.
The text was updated successfully, but these errors were encountered: