diff --git a/.changeset/dry-flowers-lay.md b/.changeset/dry-flowers-lay.md new file mode 100644 index 000000000..515ff0c41 --- /dev/null +++ b/.changeset/dry-flowers-lay.md @@ -0,0 +1,5 @@ +--- +"@livekit/components-core": patch +--- + +Don't write empty username values to local storage diff --git a/packages/core/src/persistent-storage/local-storage-helpers.ts b/packages/core/src/persistent-storage/local-storage-helpers.ts index 5bf924245..e95275da1 100644 --- a/packages/core/src/persistent-storage/local-storage-helpers.ts +++ b/packages/core/src/persistent-storage/local-storage-helpers.ts @@ -16,7 +16,10 @@ function saveToLocalStorage(key: string, value: T): void { } try { - localStorage.setItem(key, JSON.stringify(value)); + if (value) { + const nonEmptySettings = Object.entries(value).filter(([, value]) => value !== ''); + localStorage.setItem(key, JSON.stringify(nonEmptySettings)); + } } catch (error) { log.error(`Error setting item to local storage: ${error}`); }