Skip to content
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

Provide extra guarantees on Doc.Hydrate calls #1262

Closed
granicz opened this issue Sep 5, 2022 · 1 comment
Closed

Provide extra guarantees on Doc.Hydrate calls #1262

granicz opened this issue Sep 5, 2022 · 1 comment

Comments

@granicz
Copy link
Member

granicz commented Sep 5, 2022

As things currently stand, Doc.Hydrate does not work with a quoted argument, so Doc.Hydrate <@ e @> will, unexpectedly, yield no server-rendered HTML. There are ways to argue that this is by design, and that the solution is to use Doc.Hydrate(e) instead, i.e. relying on the implicit auto-quoting mechanism.

I am filing this ticket to guard against unexpected situations when using quoted arguments, so at a bare minimum a warning is raised with their source location to aid debugging.

However, I would also like to explore fixing the gap and making this work for the quoted case as well, AFAIK, there is no real good reason why that should fail. If there is, please comment below.

@Jand42
Copy link
Member

Jand42 commented Sep 6, 2022

@granicz F# auto-quotation seems under-documented, the only thing I can find is the design spec https://github.com/fsharp/fslang-design/blob/main/FSharp-4.0/AutoQuotationDesignAndSpec.md#design-overview
This includes the withValue=true feature that Doc.Hydrate is using.

I know of no F# language feature that would also evaluate the expression for <@ @>-quoted expressions.

So I think the best we can do right now is WS giving a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants