Skip to content

Commit f1b4a11

Browse files
authored
[Fix] MPA page layout (#9479)
## Describe your changes This PR addresses 2 issues with layout in both MPA v1 and v2 -- * default page layout (centered) is not respected when navigating *from* a wide layout page * when a page's layout is dynamic, e.g. changeable based on user interaction, navigating back to that page does not preserve the last set layout The proposed changes now preserve the layouts for each page in an MPA, by storing the mapping of `page script hash <> layout` in React state on page change. The layout of the page to be rendered will be looked up in every new session handling, defaulting to centered. Demo: https://multipage-layout-fix.streamlit.app/ ## GitHub Issue Link #6237 ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
1 parent 57c5569 commit f1b4a11

17 files changed

+302
-1
lines changed
5.82 KB
Loading
7.96 KB
Loading
5.93 KB
Loading
5.86 KB
Loading
8 KB
Loading
5.9 KB
Loading
5.86 KB
Loading
8.02 KB
Loading
5.9 KB
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import streamlit as st
16+
17+
st.header("Layout Pages")

0 commit comments

Comments
 (0)