On the Streamlit documentation, find out how to implement a global filter that persists its state across multiple pages in a Streamlit app. Explain the recommended app structure and the method for making widgets stateful across pages.
Navigate to 'docs.streamlit.io'. Click the search icon to reveal the search input field. In the search input field, type 'Multipage apps' and press Enter or click the search button to initiate the search. From the search results, navigate to the 'Multipage apps' documentation section. Locate and review the 'Overview of multipage apps' to understand the preferred app structure. Locate and review the 'Working with widgets in multipage apps' section. Identify the preferred strategy for defining a global filter widget to ensure its state persists across pages. Explain the recommended app structure and the method for implementing a persistent global filter, including any caveats.
State that the preferred method for structuring multipage apps is using `st.Page` and `st.navigation`. Explain that the entrypoint file acts as a 'router' or 'picture frame' when using `st.Page` and `st.navigation`. State that the preferred strategy for a global filter to persist its state is to define the widget (e.g., `st.selectbox`) in the entrypoint file. Confirm that this approach does not work if the app is defined using the `pages/` directory method.