[BUG] Missing function type hints result in None
for function inputs in FastHTML
#625
Labels
bug
Something isn't working
None
for function inputs in FastHTML
#625
Description
When using FastHTML, omitting type hints for function parameters causes input values to default to None, resulting in a TypeError. This behavior is inconsistent with the expected functionality where inputs should retain their values regardless of type hints.
Issue
Below is a sample code (adapted from FastHTML Tutorials):
The above code works perfectly!
but if we change the demo_fn removing the type hints as:
This throws error:
on debugging, we found that missing types are making the values
None
for some weird reason.This must be a bug in how fastHTL handles the data!
Expected behavior
FastHTML should not convert the function inputs to
None
if the function input param type hints are missing.Found workaround/fix
A workaround was found, by tapping into the form request. but this should work without this hack/workaround.
here is the workaround:
PS: discovered this bug & workaround while working on a project with @soumik12345
The text was updated successfully, but these errors were encountered: