1,205 questions
1
vote
1
answer
46
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....
2
votes
0
answers
82
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 ...
0
votes
2
answers
157
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 = (...
0
votes
1
answer
57
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:
...
0
votes
1
answer
363
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 ...
0
votes
0
answers
276
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(
...
1
vote
1
answer
221
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 ...
0
votes
1
answer
172
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 ...
1
vote
2
answers
2k
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"
}
},
...
0
votes
1
answer
56
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) => ...
0
votes
1
answer
268
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.
...
0
votes
0
answers
43
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 ...
2
votes
2
answers
618
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 ...
0
votes
1
answer
259
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 ...
0
votes
2
answers
923
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-...