Skip to content

Commit

Permalink
chore(xo-web/jobs): use set for user ids
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-f committed Sep 12, 2023
1 parent c0843a8 commit 704cf03
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/xo-web/src/xo-app/jobs/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { addSubscriptions } from 'utils'
import { Container } from 'grid'
import { createSelector } from 'selectors'
import { Card, CardHeader, CardBlock } from 'card'
import { filter, find, forEach, keyBy } from 'lodash'
import { filter, forEach, keyBy } from 'lodash'
import {
deleteSchedule,
deleteSchedules,
Expand Down Expand Up @@ -102,7 +102,7 @@ const ACTIONS = [
@addSubscriptions({
jobs: [cb => subscribeJobs(jobs => cb(keyBy(jobs, 'id'))), {}],
schedules: [subscribeSchedules, []],
users: [subscribeUsers, []],
userIds: [cb => subscribeUsers(user => cb(new Set(user.map(_ => _.id)))), new Set()],
})
export default class Overview extends Component {
static contextTypes = {
Expand All @@ -123,13 +123,13 @@ export default class Overview extends Component {

_getIsScheduleUserMissing = createSelector(
this._getGenericSchedules,
() => this.props.users,
() => this.props.userIds,
() => this.props.jobs,
(schedules, users, jobs) => {
(schedules, userIds, jobs) => {
const isScheduleUserMissing = {}

forEach(schedules, schedule => {
isScheduleUserMissing[schedule.id] = !find(users, user => user.id === jobs[schedule.jobId].userId)
isScheduleUserMissing[schedule.id] = !userIds.has(jobs[schedule.jobId].userId)
})

return isScheduleUserMissing
Expand Down

0 comments on commit 704cf03

Please sign in to comment.