Description
I cloned the repo and ran the demo and tried to modifie it so that I can ServerLoad
items one by one, not just swap the ServerLoad
I modified this block:
FastUI/demo/components_list.py
Lines 123 to 140 in 106d6c5
... like this:
c.Div(
components=[
c.Heading(text="Server Load SSE", level=2),
c.Markdown(text="`ServerLoad` can also be used to load content from an SSE stream."),
c.Button(text="Load SSE content", on_click=PageEvent(name="server-load-sse")),
c.Div(
components=[
c.ServerLoad(
path="/components/sse",
sse=True,
load_trigger=PageEvent(name="server-load-sse"),
components=[c.Text(text="before")],
),
],
class_name="my-2 p-2 border rounded",
),
],
class_name="border-top mt-3 pt-1",
),
And I modified this block:
FastUI/demo/components_list.py
Lines 220 to 223 in 106d6c5
... like this:
@router.get("/dynamic-content", response_model=FastUI, response_model_exclude_none=True)
async def modal_view() -> list[AnyComponent]:
await asyncio.sleep(0.5)
return [
c.Paragraph(
text="This is some dynamic content. Open devtools to see me being fetched from the server."),
c.ServerLoad(
path="/components/dynamic-content",
load_trigger=PageEvent(name="server-load"),
components=[c.Text(text="before")],
),
]
It visually works but there is something wrong with the HTML Source Code
It's probably not a "bug" or something like that, it probably works as it should be and I probably using it wrong, just asking how to do it? Do what? This...
What I'm implementing? Let's say a simple TODO app, creating tasks but I don't want to get the entire demo_page
and re-render everything, just append the new item...