Skip to content

Commit

Permalink
Fix functions that require usless returns
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundito committed Jun 6, 2022
1 parent 7d0d9be commit ff57f42
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ export const useAnalyticsRegisterValues = (props?: AnalyticsContext | null): voi
const { addContextProps, removeContextProps } = useAnalytics();

useEffect(() => {
if (props) {
addContextProps(props);

return () => removeContextProps(Object.keys(props));
if (!props) {
return;
}

addContextProps(props);
return () => removeContextProps(Object.keys(props));

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props]);
};
Expand Down
10 changes: 6 additions & 4 deletions airbyte-webapp/src/hooks/services/Feature/FeatureService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ export const useFeatureRegisterValues = (props?: Feature[] | null): void => {
const { registerFeature, unregisterFeature } = useFeatureService();

useDeepCompareEffect(() => {
if (props) {
registerFeature(props);

return () => unregisterFeature(props.map((feature: Feature) => feature.id));
if (!props) {
return;
}

registerFeature(props);

return () => unregisterFeature(props.map((feature: Feature) => feature.id));

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props]);
};
20 changes: 11 additions & 9 deletions airbyte-webapp/src/views/Connector/ServiceForm/ServiceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@ const SetDefaultName: React.FC = () => {
const { selectedService } = useServiceForm();

useEffect(() => {
if (selectedService) {
const timeout = setTimeout(() => {
// We need to push this out one execution slot, so the form isn't still in its
// initialization status and won't react to this call but would just take the initialValues instead.
setFieldValue("name", selectedService.name);
});
return () => clearTimeout(timeout);
if (!selectedService) {
return;
}

const timeout = setTimeout(() => {
// We need to push this out one execution slot, so the form isn't still in its
// initialization status and won't react to this call but would just take the initialValues instead.
setFieldValue("name", selectedService.name);
});
return () => clearTimeout(timeout);

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedService]);

Expand Down Expand Up @@ -156,9 +158,9 @@ const ServiceForm: React.FC<ServiceFormProps> = (props) => {
const { formFields, initialValues } = useBuildForm(jsonSchema, formValues);

const { setDocumentationUrl, setDocumentationPanelOpen } = useDocumentationPanelContext();
useMemo(() => {
useEffect(() => {
if (!selectedConnectorDefinitionSpecification) {
return undefined;
return;
}

const selectedServiceDefinition = availableServices.find((service) => {
Expand Down

0 comments on commit ff57f42

Please sign in to comment.