Skip to content

Commit

Permalink
Prevent new Playroom tabs from loading previously used titles (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhabib committed Feb 23, 2024
1 parent c3f0373 commit 41e8cfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-dingos-walk.md
@@ -0,0 +1,5 @@
---
'playroom': patch
---

Fix an issue where new Playroom tabs without a set title would load a recently used title.
5 changes: 1 addition & 4 deletions src/StoreContext/StoreContext.tsx
Expand Up @@ -388,7 +388,6 @@ const createReducer =

case 'updateTitle': {
const { title } = action.payload;
store.setItem('title', title);

return {
...state,
Expand Down Expand Up @@ -478,7 +477,6 @@ export const StoreProvider = ({
store.getItem<number[]>('visibleWidths'),
store.getItem<string[]>('visibleThemes'),
store.getItem<ColorScheme>('colorScheme'),
store.getItem<string | undefined>('title'),
]).then(
([
storedCode,
Expand All @@ -488,7 +486,6 @@ export const StoreProvider = ({
storedVisibleWidths,
storedVisibleThemes,
storedColorScheme,
storedTitle,
]) => {
const code = codeFromQuery || storedCode || exampleCode;
const editorPosition = storedPosition;
Expand All @@ -515,7 +512,7 @@ export const StoreProvider = ({
...(visibleThemes ? { visibleThemes } : {}),
...(visibleWidths ? { visibleWidths } : {}),
...(colorScheme ? { colorScheme } : {}),
title: titleFromQuery ?? storedTitle ?? undefined,
title: titleFromQuery,
ready: true,
},
});
Expand Down

0 comments on commit 41e8cfa

Please sign in to comment.