1,205 questions
Score of 1
1 answer
94 views
React component will not update when using redux and createSelector, not detecting UI changes
I created a selector of users in a group in my immutable redux state:
import { useStore } from 'react-redux';
import { createSelector } from '@reduxjs/toolkit'
const selectGroup = (state) => state....
Score of 2
1 answer
124 views
Why are Maps allowed where an OrderedMap is expected? (TypeScript API Design Question)
To clarify: This is nominally about Immutable.js' Map/OrderedMap, though the essence of the question is general to any TypeScript API (/structurally typed language).
I think I understand technically ...
Score of 0
2 answers
182 views
Unknown type in Immutable object
I am using Typescript 5.3.3 and I have reducer code that generates ts(2345) errors.
The reducer looks like this:
const initialState = Immutable.fromJS({
isLoading: false,
})
const myReducer = (...
Score of 0
1 answer
72 views
How to convert a nested data structure to an immutable one in a type-safe way when using Immutable?
Immutable comes with the fromJs function that transforms a regular nested data structure to an immutable one. My problem is that I can't get it to work nicely with Typescript. This is what I have:
...
Score of 0
1 answer
544 views
ts(2532) Object possibly undefined after undefined check
After upgrading our Typescript and Immutable libraries, I am seeing the error Object is possibly 'undefined'.ts(2532) in many places across our codebase even when there is an undefined check prior to ...
Score of 0
0 answers
308 views
Check if a string exists in an Immutable.Set<string[]>
Here is a mock of what I have tried with each outcome... I've read over the documentation and it seems like at least some of these things should work. Not sure what I'm doing wrong.
function getMatch(
...
Score of 1
1 answer
253 views
Avoiding type assertion when using useSelector with Redux, Immutable.js, and TypeScript
I'm currently working with a combination of Redux, Immutable.js, and TypeScript. I'm having trouble getting proper types from the useSelector hook, and I've resorted to using type assertions. I ...
Score of 0
1 answer
184 views
testing issue in redux saga method using jest
I am testing my redux saga method using jest. I am facing some issues. Attaching the saga method, test case & the console response.
Let me know where I missed it. Tried lots of googling. But ...
Score of 1
2 answers
1686 views
Update deeply nested state object in redux without spread operator
I've been breaking my head for a week or something with this !!
My redux state looks similar to this
{
data: {
chunk_1: {
deep: {
message: "Hi"
}
},
...
Score of 0
1 answer
68 views
Is there a way to set and push at the same time in a Redux action?
case 'MODIFY_NODES': {
if (action.payload.nodes) {
for (const node of action.payload.nodes) {
const setNodes = action.payload.nodes.filter(n => state.findIndex((item) => ...
Score of 0
1 answer
281 views
How do I grab value from nested immutable Map Object? Please Answer
I am trying to grab data from an array of objects called "nodes".
I've console logged:
console.log(props.mapValues.get('entries'))
to grab the object but it returns an array length of 0.
...
Score of 0
0 answers
46 views
What are the advantages of immutable data? [duplicate]
What are the advantages of using immutable libraries like immer.js or immutable.js? What is the difference between making changes to a draft of an object or making changes to a duplicate of the ...
Score of 2
2 answers
661 views
How to access value in immutable object/map in JS?
I am trying to grab the 'message' value but it is returning undefined when I use this:
console.log('message: ', props.information.getIn(['_root', 'entries']))
To console log the data below I use this ...
Score of 0
1 answer
298 views
Immutable.js difference between toJSON() and toObject() on Record
With the release of Immutable v4, there has been some api changes.
toJS(): any became toJS(): {[key: string]: unknown}
From what I understand it has been replaced by toJSON() but what's the difference ...
Score of 0
2 answers
966 views
Javascript - Grouping and filtering a list of lists
I have a value events which is a list of lists with maps that look like this:
[
[
{
"packageId": "2721",
"eventTime": "2022-03-...
