From bec65346ce090d1c5febfaacf64b236c193b8cdf Mon Sep 17 00:00:00 2001 From: Taras-Hlukhovetskyi <155433425+Taras-Hlukhovetskyi@users.noreply.github.com> Date: Tue, 24 Dec 2024 22:16:25 +0200 Subject: [PATCH] Fix [Artifacts] 'Filter by' pop-up issues on version history page (#2974) --- src/components/ActionBar/ActionBar.js | 1 - src/components/Documents/DocumentsView.js | 2 +- src/components/Files/FilesView.js | 2 +- .../FilterMenuModal/FilterMenuModal.js | 19 +++---------------- .../ModelsPage/Models/ModelsView.js | 2 +- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/components/ActionBar/ActionBar.js b/src/components/ActionBar/ActionBar.js index b2ba5ebf3..c5a6b62af 100644 --- a/src/components/ActionBar/ActionBar.js +++ b/src/components/ActionBar/ActionBar.js @@ -339,7 +339,6 @@ const ActionBar = ({ applyChanges(formState.values, filterMenuModal)} initialValues={filterMenuModalInitialState} - restartFormTrigger={`${tab}`} values={filterMenuModal} > {children} diff --git a/src/components/Documents/DocumentsView.js b/src/components/Documents/DocumentsView.js index ad5587f60..4707395d3 100644 --- a/src/components/Documents/DocumentsView.js +++ b/src/components/Documents/DocumentsView.js @@ -94,7 +94,7 @@ const DocumentsView = React.forwardRef( withRefreshButton withoutExpandButton > - + {artifactsStore.loading ? null : tableContent.length === 0 ? ( diff --git a/src/components/Files/FilesView.js b/src/components/Files/FilesView.js index 73a06a85b..6697815b4 100644 --- a/src/components/Files/FilesView.js +++ b/src/components/Files/FilesView.js @@ -106,7 +106,7 @@ const FilesView = React.forwardRef( withRefreshButton withoutExpandButton > - + {artifactsStore.loading ? null : tableContent.length === 0 ? ( diff --git a/src/components/FilterMenuModal/FilterMenuModal.js b/src/components/FilterMenuModal/FilterMenuModal.js index c09c24e08..1cc2e575e 100644 --- a/src/components/FilterMenuModal/FilterMenuModal.js +++ b/src/components/FilterMenuModal/FilterMenuModal.js @@ -17,14 +17,13 @@ illegal under applicable law, and the grant of the foregoing license under the Apache 2.0 license is conditioned upon your compliance with such restriction. */ -import React, { useCallback, useEffect, useRef, useState } from 'react' +import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { Form } from 'react-final-form' import { createForm } from 'final-form' import { isEmpty, isEqual, reduce, throttle } from 'lodash' import { useDispatch } from 'react-redux' -import { useParams } from 'react-router-dom' import { PopUpDialog, RoundedIcon, Button } from 'igz-controls/components' @@ -45,7 +44,6 @@ const FilterMenuModal = ({ filterMenuName = '', header = 'Filter by', initialValues, - restartFormTrigger = null, values, withoutApplyButton = false, wizardClassName = '' @@ -53,7 +51,6 @@ const FilterMenuModal = ({ const [filtersWizardIsShown, setFiltersWizardIsShown] = useState(false) const filtersIconButtonRef = useRef() const dispatch = useDispatch() - const params = useParams() const formRef = React.useRef( createForm({ onSubmit: () => {}, @@ -101,19 +98,10 @@ const FilterMenuModal = ({ } }, [hideFiltersWizard]) - useEffect(() => { - const ref = formRef.current - - return () => { - ref.restart(initialValues) - } + useLayoutEffect(() => { + formRef.current.reset(initialValues) }, [ - params.pageTab, - params.projectName, - restartFormTrigger, - dispatch, initialValues, - filterMenuName ]) const getFilterCounter = formState => { @@ -232,7 +220,6 @@ FilterMenuModal.propTypes = { filterMenuName: PropTypes.string, header: PropTypes.string, initialValues: PropTypes.shape({}).isRequired, - restartFormTrigger: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), values: PropTypes.shape({}).isRequired, withoutApplyButton: PropTypes.bool, wizardClassName: PropTypes.string diff --git a/src/components/ModelsPage/Models/ModelsView.js b/src/components/ModelsPage/Models/ModelsView.js index 5e71e1c4a..6194b6e9c 100644 --- a/src/components/ModelsPage/Models/ModelsView.js +++ b/src/components/ModelsPage/Models/ModelsView.js @@ -105,7 +105,7 @@ const ModelsView = React.forwardRef( withRefreshButton withoutExpandButton > - + {isAllVersions && (