Skip to content
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

Nested pydantic_form not working, just clears page #49

Open
jamesbraza opened this issue Nov 27, 2023 · 0 comments
Open

Nested pydantic_form not working, just clears page #49

jamesbraza opened this issue Nov 27, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jamesbraza
Copy link

jamesbraza commented Nov 27, 2023

Describe the bug:

When I try to have nested pydantic_forms, the page just gets cleared out.

Expected behaviour:

I expect the below code snippet to not wipe the screen after the second submit button is pressed.

Steps to reproduce the issue:

import streamlit as st
import streamlit_pydantic as sp
from pydantic import BaseModel, Field

class MinCount(BaseModel):
    min_count: int = Field(default=4, gt=0)

st.title("Test")
input_1 = sp.pydantic_form(key="input-1", model=MinCount)
if input_1:
    input_2 = sp.pydantic_form(key="input-2", model=MinCount)
    if input_2:
        st.write(f"{input_1.min_count=}, {input_2.min_count=}.")

Technical details:

  • Host Machine OS (Windows/Linux/Mac): macOS Ventura version 14.5.2, arm64
  • Browser (Chrome/Firefox/Safari): Chrome

Here are my requirements with Python 3.11:

pydantic                  2.5.2
pydantic_core             2.14.5
pydantic-settings         2.1.0
streamlit                 1.28.2
streamlit-pydantic        0.7.1

I am installing https://github.com/LukasMasuch/streamlit-pydantic/tree/390a45aba7bf8caccc297c335715cc141db490af directly from GitHub

Possible Fix:

Additional context:

@jamesbraza jamesbraza added the bug Something isn't working label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant