Skip to content

Commit

Permalink
tech: fix identity warning from redux
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault committed Sep 19, 2024
1 parent 0d96e0d commit 5c9f53a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
13 changes: 8 additions & 5 deletions frontend/src/api/regulatoryLayersAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { boundingExtent, createEmpty } from 'ol/extent'
import { createCachedSelector } from 're-reselect'

import { monitorenvPrivateApi } from './api'
import { getSelectedRegulatoryLayerIds } from '../domain/shared_slices/Regulatory'

import type {
RegulatoryLayerWithMetadata,
RegulatoryLayerWithMetadataFromAPI,
RegulatoryLayerCompact,
RegulatoryLayerCompactFromAPI
RegulatoryLayerCompactFromAPI,
RegulatoryLayerWithMetadata,
RegulatoryLayerWithMetadataFromAPI
} from '../domain/entities/regulatory'
import type { HomeRootState } from '@store/index'
import type { Coordinate } from 'ol/coordinate'

const GET_REGULATORY_LAYER_ERROR_MESSAGE = "Nous n'avons pas pu récupérer la zones réglementaire"
Expand Down Expand Up @@ -58,7 +58,10 @@ export const regulatoryLayersAPI = monitorenvPrivateApi.injectEndpoints({
export const { useGetRegulatoryLayerByIdQuery, useGetRegulatoryLayersQuery } = regulatoryLayersAPI

export const getSelectedRegulatoryLayers = createSelector(
[regulatoryLayersAPI.endpoints.getRegulatoryLayers.select(), getSelectedRegulatoryLayerIds],
[
regulatoryLayersAPI.endpoints.getRegulatoryLayers.select(),
(state: HomeRootState) => state.regulatory.selectedRegulatoryLayerIds
],
(regulatoryLayers, selectedRegulatoryLayerIds) => {
const emptyArray = []

Expand Down
9 changes: 1 addition & 8 deletions frontend/src/domain/shared_slices/Regulatory.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { createSelector, createSlice, type PayloadAction } from '@reduxjs/toolkit'
import { createSlice, type PayloadAction } from '@reduxjs/toolkit'
import _ from 'lodash'
import { persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'

import type { HomeRootState } from '../../store'

const persistConfig = {
key: 'regulatory',
storage,
Expand Down Expand Up @@ -81,8 +79,3 @@ export const {
} = regulatorySlice.actions

export const regulatorySlicePersistedReducer = persistReducer(persistConfig, regulatorySlice.reducer)

export const getSelectedRegulatoryLayerIds = createSelector(
[(state: HomeRootState) => state.regulatory.selectedRegulatoryLayerIds],
selectedRegulatoryLayerIds => selectedRegulatoryLayerIds
)

0 comments on commit 5c9f53a

Please sign in to comment.