[BUG] Inconsistency in URI compution with route URLs on attributes and uri()
and url_for()
#627
Open
4 tasks done
Labels
bug
Something isn't working
Describe the bug
There's a difference in handling URL generation depending on the use of directly passing a routed function (is that a term?) to an attribute or using the
uri
orurl_for
functions.The documentation mentions that the
uri
function computes "The function is used to generate URLs for named routes". However, this seems to be implemented with a split responsibility in that the uri function only computes an intermediate step and then thelink=
attribute does something to actually do this. So this causeshx_get=uri(...)
to fail. Also, both theuri()
andurl_for()
functions do not accept passing a function that has a route attached directly which is a big convenience in the FastHTML design and I guess this should be available there too (it did surprise me when I intuitively tried to use them this way).Minimal Reproducible Example
Provide a minimal code snippet that reproduces the issue. This is crucial for us to understand and fix the bug quickly.
Expected behavior
All examples, not just the first should run successfully and produce the proper route. Note that example 2 does run but causes an incorrect URL.
Environment Information
Please provide the following version information:
Confirmation
Please confirm the following:
The text was updated successfully, but these errors were encountered: