remove lodash forEach to reduce bundle size (#156)
This commit is contained in:
parent
7c548018c1
commit
74ea773c25
|
@ -1,7 +1,6 @@
|
||||||
import { getIdsThatRebloggedThisStatus, getNotificationIdsForStatuses } from './statuses'
|
import { getIdsThatRebloggedThisStatus, getNotificationIdsForStatuses } from './statuses'
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store'
|
||||||
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
|
||||||
import forEach from 'lodash-es/forEach'
|
|
||||||
import isEqual from 'lodash-es/isEqual'
|
import isEqual from 'lodash-es/isEqual'
|
||||||
import {
|
import {
|
||||||
deleteStatusesAndNotifications as deleteStatusesAndNotificationsFromDatabase
|
deleteStatusesAndNotifications as deleteStatusesAndNotificationsFromDatabase
|
||||||
|
@ -12,7 +11,8 @@ function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) {
|
||||||
|
|
||||||
keys.forEach(key => {
|
keys.forEach(key => {
|
||||||
let timelineData = store.getAllTimelineData(instanceName, key)
|
let timelineData = store.getAllTimelineData(instanceName, key)
|
||||||
forEach(timelineData, (ids, timelineName) => {
|
Object.keys(timelineData).forEach(timelineName => {
|
||||||
|
let ids = timelineData[timelineName]
|
||||||
if (!timelineFilter(timelineName)) {
|
if (!timelineFilter(timelineName)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ import {
|
||||||
USERNAME_LOWERCASE
|
USERNAME_LOWERCASE
|
||||||
} from './constants'
|
} from './constants'
|
||||||
|
|
||||||
import forEach from 'lodash-es/forEach'
|
|
||||||
|
|
||||||
const openReqs = {}
|
const openReqs = {}
|
||||||
const databaseCache = {}
|
const databaseCache = {}
|
||||||
|
|
||||||
|
@ -47,8 +45,8 @@ export function getDatabase (instanceName) {
|
||||||
? db.createObjectStore(name, init)
|
? db.createObjectStore(name, init)
|
||||||
: db.createObjectStore(name)
|
: db.createObjectStore(name)
|
||||||
if (indexes) {
|
if (indexes) {
|
||||||
forEach(indexes, (indexValue, indexKey) => {
|
Object.keys(indexes).forEach(indexKey => {
|
||||||
store.createIndex(indexKey, indexValue)
|
store.createIndex(indexKey, indexes[indexKey])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,6 @@ module.exports = {
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new LodashModuleReplacementPlugin({
|
new LodashModuleReplacementPlugin({
|
||||||
collections: true,
|
|
||||||
caching: true
|
caching: true
|
||||||
})
|
})
|
||||||
].concat(isDev ? [
|
].concat(isDev ? [
|
||||||
|
|
Loading…
Reference in a new issue