Fixed AddCall Scrolling

This commit is contained in:
Luke Berndt
2023-01-16 09:40:12 -05:00
parent dfae44d861
commit 14906865a1
2 changed files with 39 additions and 35 deletions

View File

@@ -66,6 +66,7 @@ const initialState = {
data: callsAdapter.getInitialState(),
oldestCallTime: now,
newestCallTime: now,
adjustCallScroll: false
}
function buildUrlParams(a) {
@@ -201,9 +202,9 @@ export const callsSlice = createSlice({
name: 'calls',
initialState,
reducers: {
addCall: (state, action) => {
state.data = callsAdapter.addOne(state.data, action.payload)
state.adjustCallScroll = true;
},
},
extraReducers: {
@@ -219,7 +220,7 @@ export const callsSlice = createSlice({
if (state.data && (state.data.ids.length > 0)) {
const first = state.data.ids[0]
const firstTime = state.data.entities[first].time;
const last = state.data.ids[state.data.ids[0].length-1];
const last = state.data.ids[state.data.ids.length-1];
const lastTime = state.data.entities[last].time;
state.newestCallTime = new Date(firstTime)
state.oldestCallTime = new Date(lastTime)
@@ -237,7 +238,7 @@ export const callsSlice = createSlice({
if (state.data && (state.data.ids.length > 0)) {
const first = state.data.ids[0]
const firstTime = state.data.entities[first].time;
const last = state.data.ids[state.data.ids[0].length-1];
const last = state.data.ids[state.data.ids.length-1];
const lastTime = state.data.entities[last].time;
state.newestCallTime = new Date(firstTime)
state.oldestCallTime = new Date(lastTime)
@@ -255,7 +256,7 @@ export const callsSlice = createSlice({
if (state.data && (state.data.ids.length > 0)) {
const first = state.data.ids[0]
const firstTime = state.data.entities[first].time;
const last = state.data.ids[state.data.ids[0].length-1];
const last = state.data.ids[state.data.ids.length-1];
const lastTime = state.data.entities[last].time;
state.newestCallTime = new Date(firstTime)
state.oldestCallTime = new Date(lastTime)