From 0baa74ff0a24922a116980f22645415172d49d1a Mon Sep 17 00:00:00 2001 From: Yaroslav Kuznietsov Date: Fri, 23 Jul 2021 15:27:13 +0300 Subject: [PATCH] `Datasource` refactored from `recompose` to `hooks`. --- .../public/components/datasource/datasource.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/canvas/public/components/datasource/datasource.js b/x-pack/plugins/canvas/public/components/datasource/datasource.js index c2aa9b7f5c5ce..acda812792c45 100644 --- a/x-pack/plugins/canvas/public/components/datasource/datasource.js +++ b/x-pack/plugins/canvas/public/components/datasource/datasource.js @@ -5,20 +5,17 @@ * 2.0. */ -import { compose, branch, renderComponent } from 'recompose'; +import React from 'react'; import PropTypes from 'prop-types'; import { NoDatasource } from './no_datasource'; import { DatasourceComponent } from './datasource_component'; -const branches = [ - // rendered when there is no datasource in the expression - branch( - ({ datasource, stateDatasource }) => !datasource || !stateDatasource, - renderComponent(NoDatasource) - ), -]; +export const Datasource = (props) => { + const { datasource, stateDatasource } = props; + if (!datasource || !stateDatasource) return ; -export const Datasource = compose(...branches)(DatasourceComponent); + return ; +}; Datasource.propTypes = { args: PropTypes.object,