Skip to content

Commit 6888374

Browse files
committed
Fix a bug with the caseInsensitiveMatch if the space name is false (not a string)
1 parent 312b003 commit 6888374

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

js/background/background.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,12 +1401,8 @@ async function requestAllSpaces() {
14011401
const allSessions = await spacesService.getAllSessions();
14021402
/** @type {Space[]} */
14031403
const allSpaces = allSessions
1404-
.map(session => {
1405-
return { sessionId: session.id, ...session };
1406-
})
1407-
.filter(session => {
1408-
return session && session.tabs && session.tabs.length > 0;
1409-
});
1404+
.map(session => { return { sessionId: session.id, ...session } })
1405+
.filter(session => session?.tabs?.length > 0);
14101406

14111407
// sort results
14121408
allSpaces.sort((a, b) => {

js/popup.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ function routeView(action) {
8585
*/
8686

8787
function renderCommon() {
88-
document.getElementById('activeSpaceTitle').value = globalCurrentSpace.name ?? UNSAVED_SESSION;
88+
document.getElementById(
89+
'activeSpaceTitle'
90+
).value = globalCurrentSpace.name
91+
? globalCurrentSpace.name
92+
: UNSAVED_SESSION;
8993

9094
document.querySelector('body').onkeyup = e => {
9195
// listen for escape key
@@ -219,7 +223,8 @@ export async function handleNameSave() {
219223
// to check for overwrite, we just let the capitalization change happen.
220224
// TESTME: Save should occur when the name is a case-insensitive match of the previous name and
221225
// the requestSessionPresence message should not be sent.
222-
const caseInsensitiveMatch = globalCurrentSpace.name.toLowerCase() === newName.toLowerCase();
226+
const caseInsensitiveMatch = globalCurrentSpace?.name
227+
&& globalCurrentSpace.name.toLowerCase() === newName.toLowerCase();
223228
const canOverwrite = caseInsensitiveMatch || await checkSessionOverwrite(newName);
224229
if (!canOverwrite) {
225230
inputEl.value = globalCurrentSpace.name || UNSAVED_SESSION;

js/spaces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ export async function handleNameSave() {
332332
// name is a case-insensitive match of the previous name, we do not need to check overwrite.
333333
// TESTME: Save should occur when the name is a case-insensitive match of the previous name and
334334
// the requestSessionPresence message should not be sent.
335-
const caseInsensitiveMatch = name.toLowerCase() === newName.toLowerCase();
335+
const caseInsensitiveMatch = name && name.toLowerCase() === newName.toLowerCase();
336336
const canOverwrite = caseInsensitiveMatch || await checkSessionOverwrite(newName);
337337
if (!canOverwrite) {
338338
updateNameForm(globalSelectedSpace);

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Spaces",
33
"description": "Intuitive tab management",
4-
"version": "1.1.8.1",
4+
"version": "1.1.8.2",
55
"permissions": [
66
"contextMenus",
77
"downloads",

0 commit comments

Comments
 (0)