Questions tagged [reselect]

Reselect is a selector library for Redux.

Reselect is a selector library which uses memoization. It was originally written to compute derived data from -like applications state, but it's not strictly coupled to any specific architecture/library.

Reselect keeps a copy of the last inputs/outputs of the last call, and recomputes the result ONLY IF one of the inputs changes. If the the same inputs are provided twice in a row, Reselect return the cached saved output.

Reselect's memoization and caching are fully customizable.


Resources

387 questions
0
votes
1 answer

Combine nested result using selectors

I am using reselect to derive my data from the store. I maintain a list of Divisions and Teams and each Division has it's list of teams. I also keep a record of the active Divisions and keep them in an array activeIds. Basically I have this tree…
JohnnyQ
  • 4,839
  • 6
  • 47
  • 65
0
votes
1 answer

updated nested Immutable in immutable.js

how can i update a nested immutable Map item without mutatiling the whole tree ? example : var tree = Map({ branch1:Map([]), branch2:Map({ 1: Map({id:1,value:'hello'}) }), }); how can i update tree.branch2.1.value ? will this cause branch1 to get…
Zalaboza
  • 8,899
  • 16
  • 77
  • 142
0
votes
1 answer

Structure for auth flow with React and Redux

I have a working auth flow for a React/Redux app, and I'm using reselect and redux-saga to handle state selection and async login/register functionality. I have a single container that I've been using for testing, with login, register, logout all…
Toby
  • 12,743
  • 8
  • 43
  • 75
0
votes
0 answers

Using `reselect` in a react-redux application with async actions

If I'm using an async redux library along with reselect, is there a definitive pattern for performing a selection in mapStateToProps when the state object being "selected" depends on the completion of the async action? I'm using the following…
Himmel
  • 3,629
  • 6
  • 40
  • 77
0
votes
1 answer

ReactJs reselect recalculates all selectors every time

I have a reducer that holds blog posts of various types. I'm using select to fetch part of the data that I need, yet every time the state change reselect recalculates all the selectors. initialstate = { blogPosts: { byId: { 1: { id: 1, parent:…
Zalaboza
  • 8,899
  • 16
  • 77
  • 142
0
votes
1 answer

Filtering 2 arrays with React Reselect

I'm using React Reselect and I'm trying to filter the selectedClients such that I only return clients.all that have id's from selectedClientsIds. selected_clients.js import _ from 'lodash'; import { createSelector } from 'reselect'; const…
lost9123193
  • 10,460
  • 26
  • 73
  • 113
0
votes
1 answer

Redux - cross-entity state management

I'm using Redux and ImmutableJS to manage the state of my app. I've created the following two Records: export const OrderRecord = Record({ id: null, productId: null, amount: 1, }); export const ProductRecord = Record({ id: null, …
jezikk
  • 111
  • 2
  • 9
0
votes
1 answer

After fetching raw data, where can I parse raw data in react-redux app?

I just fetched some raw data from a server and after that I need to parse the data before I render them on a component. So where should I put the code to parse data? In the reducer or in the action? I think it should be put in reducer, but is that…
user6557921
  • 55
  • 1
  • 3
0
votes
1 answer

redux reselect keeps re-computing

I have this list of items, each of which when clicked changes the state.ui.clickedItem to that clicked item itself. And I want to compute the items' associated Assignments record. So I have this reselect selector: import { createSelector } from…
Nik So
  • 16,683
  • 21
  • 74
  • 108
-1
votes
1 answer

redux reselect fat arrow function argument with assigning

i am new to redux and es6. I m little confused with below fat arrow function. I know fat arrow function. But What this ( record = EMPTY_OBJECT ) does? are we assigning default value(Empty Object) if no arguments found ? const EMPTY_OBJECT =…
Munna Babu
  • 5,496
  • 6
  • 29
  • 44
-2
votes
2 answers

how to build object JS

I have an array of booking and types. From these two arrays I need to build an object. Everything works great, except for the types. Types return an array in each object (same). How can you return the correct object? const booking = [{row: 1, num:…
TeenDay
  • 54
  • 7
-2
votes
1 answer

Why is state now undefined in ngrx app after reselect refactoring?

I just went through my formerly working application and refactored it to use reselect as the ngrx example app now does. I don't have any compile errors but I have this runtime error: error_handler.js:53 TypeError: Cannot read property 'token' of…
Dan Cancro
  • 1,401
  • 5
  • 24
  • 53
1 2 3
25
26