Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Cloud, out of date connectors call always returns 0 #21126

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions airbyte-webapp/src/services/connector/ConnectorService.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { useConfig } from "config";
import { webBackendCheckUpdates } from "core/request/AirbyteClient";
import { webBackendCheckUpdates, WebBackendCheckUpdatesRead } from "core/request/AirbyteClient";
import { AirbyteRequestService } from "core/request/AirbyteRequestService";
import { useDefaultRequestMiddlewares } from "services/useDefaultRequestMiddlewares";
import { useInitService } from "services/useInitService";
import { isCloudApp } from "utils/app";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great as a hotfix—small, simple, direct, effective—but I do think that a good follow-up would be editing the conditional to check if FeatureItem.AllowUpdateConnectors is enabled instead of checking isCloud(). It looks like we don't really have an API for that besides useFeature, which is a bummer: right now this module doesn't introduce any react-specific context like hooks impose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing conditionals with hooks always gets awkward, but yeah.
We're going to revert the backend change Monday so maybe @josephkmh can make that change if he gets to it before I'm online!

Copy link
Contributor

@josephkmh josephkmh Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ambirdsall agreed - I have an open issue here proposing that approach. I'll keep that issue open as a refactor of this hotfix.


class ConnectorService extends AirbyteRequestService {
checkUpdates() {
checkUpdates(): Promise<WebBackendCheckUpdatesRead> {
if (isCloudApp()) {
return Promise.resolve({ sourceDefinitions: 0, destinationDefinitions: 0 });
}
return webBackendCheckUpdates(this.requestOptions);
}
}
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/utils/app.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const isCloudApp = () => process.env.REACT_APP_CLOUD || window.CLOUD === "true";
export const isCloudApp = () => (process.env.REACT_APP_CLOUD || window.CLOUD) === "true";