Skip to content

Commit c7e50af

Browse files
loiswells97MagdalenaJadach
andauthored
Fix web component tabbed view (#1114)
Small fix to stop web component switching to the pre-set split/tabbed view on every code run I thought this was related to the `pyodide` switch but it turned out not to be - this is actually an annoying bug that is live on production 😅 --------- Co-authored-by: MagdalenaJadach <[email protected]>
1 parent fd604a8 commit c7e50af

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2929
- Build to include public files (#1112)
3030
- Dynamic runner switching with more than one `python` file (#1097)
3131
- Pyodide running the correct file (`main.py`) when there are multiple `python` files (#1097)
32+
- Persisting choice of tabbed/split view when running `python` code (#1114)
3233

3334
## [0.27.1] - 2024-10-01
3435

src/components/WebComponentProject/WebComponentProject.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ const WebComponentProject = ({
5252
const [codeHasRun, setCodeHasRun] = useState(codeHasBeenRun);
5353
const dispatch = useDispatch();
5454

55-
dispatch(setIsSplitView(outputSplitView));
56-
dispatch(setWebComponent(true));
57-
dispatch(setIsOutputOnly(outputOnly));
55+
useEffect(() => {
56+
dispatch(setIsSplitView(outputSplitView));
57+
dispatch(setWebComponent(true));
58+
dispatch(setIsOutputOnly(outputOnly));
59+
}, [outputSplitView, outputOnly, dispatch]);
5860

5961
useEffect(() => {
6062
setCodeHasRun(false);

0 commit comments

Comments
 (0)