From c417ab4e75ab2d712a2f4da8a95eaa5c121e22fd Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 1 Jan 2024 10:35:22 +1300 Subject: [PATCH] . --- client/dist/js/bundle.js | 13 +++++++------ .../components/ElementEditor/AddElementPopover.js | 9 +++++---- .../src/components/ElementEditor/ElementEditor.js | 3 ++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index d0e9de2d..44fd5d6a 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -970,8 +970,8 @@ var AddElementPopover = function (_Component) { } _createClass(AddElementPopover, [{ - key: 'getElementButtonClickHandler', - value: function getElementButtonClickHandler(elementType) { + key: 'getGraphQLElementButtonClickHandler', + value: function getGraphQLElementButtonClickHandler(elementType) { var _this2 = this; return function (event) { @@ -990,8 +990,8 @@ var AddElementPopover = function (_Component) { }; } }, { - key: 'handleButtonOnClick', - value: function handleButtonOnClick(elementType) {} + key: 'getElementButtonClickHandler', + value: function getElementButtonClickHandler(elementType) {} }, { key: 'handleToggle', value: function handleToggle() { @@ -1003,6 +1003,8 @@ var AddElementPopover = function (_Component) { }, { key: 'render', value: function render() { + var _this3 = this; + var _props2 = this.props, PopoverOptionSetComponent = _props2.PopoverOptionSetComponent, elementTypes = _props2.elementTypes, @@ -1016,14 +1018,13 @@ var AddElementPopover = function (_Component) { var popoverClassNames = (0, _classnames2.default)('element-editor-add-element', extraClass); var globalUseGraphQL = true; - var buttonOnClickHandler = globalUseGraphQL ? this.getElementButtonClickHandler : this.handleButtonOnClick; var buttons = elementTypes.map(function (elementType) { return { content: elementType.title, key: elementType.name, className: (0, _classnames2.default)(elementType.icon, 'btn--icon-xl', 'element-editor-add-element__button'), - onClick: buttonOnClickHandler(elementType) + onClick: globalUseGraphQL ? _this3.getGraphQLElementButtonClickHandler(elementType) : _this3.getElementButtonClickHandler(elementType) }; }); diff --git a/client/src/components/ElementEditor/AddElementPopover.js b/client/src/components/ElementEditor/AddElementPopover.js index 358be502..39e1cdd0 100644 --- a/client/src/components/ElementEditor/AddElementPopover.js +++ b/client/src/components/ElementEditor/AddElementPopover.js @@ -25,7 +25,7 @@ class AddElementPopover extends Component { * @param {object} elementType in the shape of types/elmementTypeType * @returns {function} */ - getElementButtonClickHandler(elementType) { + getGraphQLElementButtonClickHandler(elementType) { return (event) => { const { actions: { handleAddElementToArea }, @@ -50,7 +50,7 @@ class AddElementPopover extends Component { * - then call read blocks from area endpoint (areaID) * - also then update the preview via jquery/entwine */ - handleButtonOnClick(elementType) { + getElementButtonClickHandler(elementType) { // todo } @@ -79,13 +79,14 @@ class AddElementPopover extends Component { ); const globalUseGraphQL = true; - const buttonOnClickHandler = globalUseGraphQL ? this.getElementButtonClickHandler : this.handleButtonOnClick; const buttons = elementTypes.map((elementType) => ({ content: elementType.title, key: elementType.name, className: classNames(elementType.icon, 'btn--icon-xl', 'element-editor-add-element__button'), - onClick: buttonOnClickHandler(elementType), + onClick: globalUseGraphQL + ? this.getGraphQLElementButtonClickHandler(elementType) + : this.getElementButtonClickHandler(elementType), })); return ( diff --git a/client/src/components/ElementEditor/ElementEditor.js b/client/src/components/ElementEditor/ElementEditor.js index 7cd00aa2..f9c9284f 100644 --- a/client/src/components/ElementEditor/ElementEditor.js +++ b/client/src/components/ElementEditor/ElementEditor.js @@ -67,7 +67,8 @@ class ElementEditor extends PureComponent { } else { // # rpc // make a call to a sort endpoint with (ID, afterBlocKID) - // after that is done, get ElementList to refetch the list of blocks + // after sort there is NOT a call to readAll elements, GraphQL will only do a fairly pointless + // call to read the element that was moved // (strange code for sorting is in this component and not ElementList, however do not refator it) // update the preview via jquery/entwine (see graphql code above) }