diff --git a/wlm-ui/src/MainPage/Channel/Channel.tsx b/wlm-ui/src/MainPage/Channel/Channel.tsx index c17cb8d..7089226 100644 --- a/wlm-ui/src/MainPage/Channel/Channel.tsx +++ b/wlm-ui/src/MainPage/Channel/Channel.tsx @@ -53,7 +53,10 @@ const Channel = (props: IProps) => { dispatch(channelListActions.removeOldMeasurements({ channel: channel })); }, 10 * 60 * 1000); - return () => clearInterval(interval); + return () => { + clearInterval(interval); + dispatch(channelListActions.removeAllMeasurements({ channel: channel })); + }; }, [dispatch, props.channel.channel]); useEffect(() => { diff --git a/wlm-ui/src/store/slices/channel/channel.ts b/wlm-ui/src/store/slices/channel/channel.ts index 662bef6..73b4862 100644 --- a/wlm-ui/src/store/slices/channel/channel.ts +++ b/wlm-ui/src/store/slices/channel/channel.ts @@ -108,6 +108,10 @@ export const channelListSlice = createSlice({ info.measurements = info.measurements.filter( measurement => new Date(measurement.measuredAt) > cutoffTime); }, + removeAllMeasurements: (state, action: PayloadAction>) => { + const info = getChannelInfoWithException(state, action.payload.channel); + info.measurements = []; + }, }, extraReducers: (builder) => { builder