Skip to content

Commit

Permalink
Fix [Feature vectors] features version tags aren't changed when chang…
Browse files Browse the repository at this point in the history
…ing the project (#2615)
  • Loading branch information
Taras-Hlukhovetskyi authored Jul 22, 2024
1 parent 1181846 commit a789255
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 13 additions & 2 deletions src/components/AddToFeatureVectorPage/AddToFeatureVectorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { filters } from './addToFeatureVectorPage.util'
import { getFeatureIdentifier } from '../../utils/getUniqueIdentifier'
import { handleFeaturesResponse } from '../FeatureStore/Features/features.util'
import { isEveryObjectValueEmpty } from '../../utils/isEveryObjectValueEmpty'
import { setFilters } from '../../reducers/filtersReducer'
import { getFilterTagOptions, setFilters } from '../../reducers/filtersReducer'
import { setNotification } from '../../reducers/notificationReducer'
import { setTablePanelOpen } from '../../reducers/tableReducer'
import { showErrorNotification } from '../../utils/notifications.util'
Expand Down Expand Up @@ -170,6 +170,17 @@ const AddToFeatureVectorPage = ({
[fetchFeatures]
)

const handleRefresh = filters => {
dispatch(
getFilterTagOptions({ fetchTags: fetchFeatureSetsTags, project: filters.project })
)

setContent([])
setSelectedRowData({})

return fetchData(filters)
}

const handleRemoveFeature = useCallback(
feature => {
const newStoreSelectedRowData = {
Expand Down Expand Up @@ -306,9 +317,9 @@ const AddToFeatureVectorPage = ({
content={content}
convertedYaml={convertedYaml}
featureStore={featureStore}
fetchData={fetchData}
filtersStore={filtersStore}
handleExpandRow={handleExpandRow}
handleRefresh={handleRefresh}
largeRequestErrorMessage={largeRequestErrorMessage}
pageData={pageData}
ref={addToFeatureVectorPageRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ const AddToFeatureVectorView = React.forwardRef(
content,
convertedYaml,
featureStore,
fetchData,
filtersStore,
handleExpandRow,
handleRefresh,
largeRequestErrorMessage,
pageData,
selectedRowData,
Expand All @@ -67,7 +67,7 @@ const AddToFeatureVectorView = React.forwardRef(
<div className="content__action-bar-wrapper">
<FilterMenu
filters={filters}
onChange={fetchData}
onChange={handleRefresh}
page={FEATURE_STORE_PAGE}
withoutExpandButton
/>
Expand All @@ -88,7 +88,7 @@ const AddToFeatureVectorView = React.forwardRef(
actionsMenu={actionsMenu}
hideActionsMenu={tableStore.isTablePanelOpen}
pageData={pageData}
retryRequest={fetchData}
retryRequest={handleRefresh}
tab={ADD_TO_FEATURE_VECTOR_TAB}
tableClassName="features-table"
tableHeaders={tableContent[0]?.content ?? []}
Expand Down Expand Up @@ -128,9 +128,9 @@ AddToFeatureVectorView.propTypes = {
content: PropTypes.arrayOf(PropTypes.object).isRequired,
convertedYaml: PropTypes.string.isRequired,
featureStore: PropTypes.object.isRequired,
fetchData: PropTypes.func.isRequired,
filtersStore: PropTypes.object.isRequired,
handleExpandRow: PropTypes.func.isRequired,
handleRefresh: PropTypes.func.isRequired,
largeRequestErrorMessage: PropTypes.string.isRequired,
pageData: PropTypes.object.isRequired,
selectedRowData: PropTypes.object.isRequired,
Expand Down

0 comments on commit a789255

Please sign in to comment.