Skip to content

Fix sourcegraph.configuration

Administrator requested to merge lg/fix-configuration into master

Created by: lguychard

https://github.com/sourcegraph/sourcegraph/pull/7235 did not actually allow using from(sourcegraph.configuration) in extensions: since { subscribe: configuration.subscribe.bind(configuration) } does not expose Symbol_observable, subscription fails with TypeError: You provided an invalid object where a stream was expected.

This is my best shot at fixing this, by implementing ExtConfiguration as a subclass of ReplaySubject. It removes a fair bit of internal boilerplate, and actually fixes an existing race condition: subscribing to soucegraph.configuration before initial settings were received would throw -- even though this is precisely what exposing a Subscribable is designed to avoid! I added tests to verify this.

Merge request reports

Loading