-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Resolve #304: Relax type requirement on pc.cond #323
Conversation
tests/components/layout/test_cond.py
Outdated
cond_component = pc.cond( | ||
cond_state.value, | ||
pc.text("cond is True"), | ||
pc.text("cond is False"), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyright is complaining error: Module is not callable
. Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may because we do some magic to create the pc.
functions. In the tests maybe we can try to import the components directly:
from pynecone.components.typography.text import Text
from pynecone.components.layout.cond import Cond
Then call the create method explicitly:
cond_component = Cond.create(
cond_state.value,
Text.create("cond is True"),
Text.create("cond is False"),
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It seems to fix it.
This may because we do some magic to create the pc. functions.
I am curious how we do this? e.g. I don't see any def cond():
for pc.cond
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the line that does the magic: we create pc.
functions that map to each component's create
method.
Thanks for this change! If the fix doesn't work, we can also put a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
Resolve #304: Relax type requirement on pc.cond