Skip to content

Commit

Permalink
Don't write empty username values to local storage (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO authored Sep 6, 2024
1 parent 8b25503 commit 9b1a259
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dry-flowers-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/components-core": patch
---

Don't write empty username values to local storage
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ function saveToLocalStorage<T extends JsonValue>(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}`);
}
Expand Down

0 comments on commit 9b1a259

Please sign in to comment.