Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
Why can't I set a file type variable in the redux toolkit state?

I'm trying to set a file inside a slice with redux-toolkit but it doesn't work.

First, here is my slice file

import { createSlice } from "@reduxjs/toolkit"

export const assignorsSlice = createSlice({
  name: "assignors",
  initialState: {
    list: [],
    assignorFileSignToUpdate: null,
  },
  reducers: {
    getAssignorsList: (state) => {
      return state.list
    },
    setAssignorsList: (state, action) => {
      state.list = action.payload
    },
    addAssignor: (state, action) => {
      state.list.push(action.payload)
    },
    toggleAssignor: (state, action) => {
      const rut = action.payload
      const assignor = state.list.find((assignor) => {
        return assignor.rut === rut
      })
      assignor.active = !assignor.active
    },
    setAssignorFileSignToUpdate: (state, action) => {
      state.assignorFileSignToUpdate = action.payload
      console.log(
        "🚀 ~ file: assignors.js ~ line 28 ~ action.payload",
        action.payload
      )
      console.log(
        "🚀 ~ file: assignors.js ~ line 29 ~ state.assignorFileSignToUpdate",
        state.assignorFileSignToUpdate
      )
    },
    getAssignorFileSignToUpdate: (state) => {
      return state.assignorFileSignToUpdate
    },
  },
})

// export actions
export const {
  setAssignorsList,
  addAssignor,
  toggleAssignor,
  getAssignorsList,
  setAssignorFileSignToUpdate,
  getAssignorFileSignToUpdate,
} = assignorsSlice.actions

export default assignorsSlice.reducer

The problem is in the setAssignorFileSignToUpdate action, I logged the payload and the state variable. The payload and the state in the console.log are correct, but the redux chrome extensión shows the assignorFileSignToUpdate variable with an empty object (see the image).

console and redux screenshot

In the slice file the assignorFileSignToUpdate variable is a file (the console.log shows it), but in the redux chrome extension is not, and when I call the useSelector to see this variable is an empty object too.

I don't know why this is happening, if you guys know the mistake I made or a way to fix it I would really appreciate it. Thanks in advance.

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!