reflex
reflex copied to clipboard
When using skeleton's is_loaded with State, it does not become True.
Describe the bug A clear and concise description of what the bug is.
When using skeleton's is_loaded with State, it does not become True.
To Reproduce Steps to reproduce the behavior:
- Code/Link to Repo:
Part of my code is below.
class QueryState(BaseState):
labels: List[str] = []
taints: List[str] = []
nodes: List[str] = api.get_nodes()
is_loaded: bool = False
def refresh_nodes(self):
self.is_loaded = False
self.nodes = api.get_nodes(self.labels, self.taints)
self.is_loaded = True
pc.box(
pc.button(
pc.icon(tag="Refresh"),
color_scheme="green",
on_click=[
QueryState.refresh_nodes,
],
)
pc.box(
pc.foreach(
QueryState.nodes,
lambda node: pc.box(
pc.skeleton(
pc.text(node),
is_loaded=QueryState.is_loaded,
),
),
),
)
)

When refresh_nodes()
is called, is_loaded
of QueryState
should be changed to False
and then changed back to True
.
However, if I check the page, it still seems that the skeleton is only left with is_loaded=False
.
Even though the QueryState.nodes
value is filled in, the value does not appear and only the skeleton box still appears.
What's the matter? How can I solve this?
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
** Specifics (please complete the following information):**
- Python Version: 3.11.0
- Pynecone Version: 0.1.14
- OS: Mac OS Monetrey 12.6
- Browser (Optional): Chrome 109.0.5414.87 arm 64
Additional context Add any other context about the problem here.