Skip to content

Fix observing/parsing local storage client settings

Administrator requested to merge fix-native-integration-local-storage into main

Created by: marekweb

Background

Fix #15088

LocalStorageSubject is used in the native integration to observe updates to localStorage for the value of sourcegraphClientSettings but it automatically parses the values as JSON.

This is a mismatch with the behavior of the other observer we use, observeStorageKey for extension storage. In createStorageSettingsCascade we switch between these two storage locations as if they were equivalent, based on whether we're in a browser extension or a native integration (using isInPage)

This caused the bug in the native integration in which we double-parse values that are coming from LocalStorageSubject and it throws a e.charCodeAt is not a function error.

Implementation

This change drops the usage of LocalStorageSubject in this particular instance, in favor of observeLocalStorageKey which mirrors the behavior of observeStorageKey.

Merge request reports

Loading