Use preview server when not on stable (#2909)

This PR updates our client code to connect to preview whenever we're not
on stable. This will make it more likely that we'll be able to
collaborate on a dev build, but obviously won't work if there's a
protocol change on main that hasn't made its way to preview yet.
This commit is contained in:
Nathan Sobo 2023-09-06 10:09:08 -06:00 committed by GitHub
commit a2e91e45d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1011,9 +1011,9 @@ impl Client {
credentials: &Credentials,
cx: &AsyncAppContext,
) -> Task<Result<Connection, EstablishConnectionError>> {
let is_preview = cx.read(|cx| {
let use_preview_server = cx.read(|cx| {
if cx.has_global::<ReleaseChannel>() {
*cx.global::<ReleaseChannel>() == ReleaseChannel::Preview
*cx.global::<ReleaseChannel>() != ReleaseChannel::Stable
} else {
false
}
@ -1028,7 +1028,7 @@ impl Client {
let http = self.http.clone();
cx.background().spawn(async move {
let mut rpc_url = Self::get_rpc_url(http, is_preview).await?;
let mut rpc_url = Self::get_rpc_url(http, use_preview_server).await?;
let rpc_host = rpc_url
.host_str()
.zip(rpc_url.port_or_known_default())