1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Better lookback update

This commit is contained in:
Zhiyuan Zheng
2022-01-30 22:51:03 +01:00
parent 45ba984ea3
commit bd49caa52a
13 changed files with 116 additions and 106 deletions

View File

@ -3,7 +3,6 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { RootState } from '@root/store'
import { ComposeStateDraft } from '@screens/Compose/utils/types'
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
import { findIndex } from 'lodash'
import addInstance from './instances/add'
import removeInstance from './instances/remove'
import { updateAccountPreferences } from './instances/updateAccountPreferences'
@ -130,10 +129,9 @@ const instancesSlice = createSlice({
action: PayloadAction<ComposeStateDraft>
) => {
const activeIndex = findInstanceActive(instances)
const draftIndex = findIndex(instances[activeIndex].drafts, [
'timestamp',
action.payload.timestamp
])
const draftIndex = instances[activeIndex].drafts.findIndex(
({ timestamp }) => timestamp === action.payload.timestamp
)
if (draftIndex === -1) {
instances[activeIndex].drafts.unshift(action.payload)
} else {