Questions tagged [createentityadapter]
25 questions
3
votes
1 answer
Redux Toolkit Streaming updates - how to deal with relational entity adapters?
I am working on the chat that is utilising RTK Query with entity adapters.
I currently have 2 different entity adapters; one for chat and one for messages.
How can I go about selecting all messages for a specific chat? Do I need to store array of…

mnbxx
- 55
- 5
3
votes
1 answer
How to apply createEntityAdapter to createApi slice
I have implemented successfully a redux-toolkit api. Now Im trying to use createEntityAdapter to be able to use the pre-built selector methods.
import {
createEntityAdapter,
createSelector,
} from '@reduxjs/toolkit'
import api from…

Rashomon
- 5,962
- 4
- 29
- 67
2
votes
1 answer
Redux Toolkit: How to normalize group chat messages?
I have an array of messages returned from the server where each chat message has the following format:
export interface ChatMessage {
_id: string | number;
text: string;
createdAt: Date | number;
user: ChatUser;
groupId:…

abdou-tech
- 687
- 1
- 8
- 16
2
votes
1 answer
How to type properties in merging object for getInitialState of createEntityAdapter object?
I want to type status with FetchingStatus type. How to implement that?
type FetchingStatus = 'idle' | 'loading' | 'succeeded' | 'failed';
const initialState = companyPagesAdapter.getInitialState({
status: 'idle',
perPage: 1,
…

Dima Kambalin
- 283
- 2
- 12
1
vote
0 answers
RTK Query Getting Data Based On Shop Id While Creating EntityAdapter
I have a problem with setting my rtk query ApiSlice. So what i want to achieve is to get all reviews of a shop or user. I am passing role so i can check should i look for User or Shop, and id to find the right one. Now what i want is to after that…

Vlada Stefanovic
- 27
- 2
1
vote
1 answer
How to user RTK Query createEntityAdapter to normalize a response that has "meta" and "links" entries
So, I have a response that gets paginated users, and it looks something like this ...
{
data:[{...}, {...}],
links: {first:..., last:...},
meta: {current_page: 1, total: 400, from: 1, to: 10}
}
Now, when using createEntityAdapter to normalize…

Ruby
- 2,207
- 12
- 42
- 71
1
vote
0 answers
Redux toolkit: updating state with entityAdapter vs custom callback
In have an async request to log a user in:
export const loginUser = createAsyncThunk('users/login', async userInputs => {
try {
const { data } = await axios.post(
'url',
userInputs
);
Cookies.set('user',…

AndyOh
- 87
- 1
- 9
1
vote
0 answers
Redux Error: Application state or actions payloads are too large - what is the issue?
VM75:3075 Application state or actions payloads are too large making Redux DevTools serialization slow and consuming a lot of memory. See https://git.io/fpcP5 on how to configure it.
I am getting the error above when working with Redux Toolkit RTK…

mnbxx
- 55
- 5
1
vote
1 answer
Redux and create entity adapter - how to read an entity data?
I have create separate slice for entity adapters that I have inside of /redux/slices/messagesSlice.ts. When I try to access store from inside of that file it appears as undefined.
I need to access state (store.getState()) inside of my…

mnbxx
- 55
- 5
1
vote
1 answer
RTK createEntityAdapter not getting relational data in list after save user in database
i have a list of users which getting data from database by using RTK createEntityAdapter.
API function code for getting list of users
public function index(){
$roles = Role::all();
$all_roles = [];
foreach ($roles as $key =>…

shazim ali
- 360
- 4
- 18
1
vote
1 answer
Redux Toolkit createEntityAdapter: how can i get current state of adapter?
I am seeing TS type errors trying to pass state into an entityAdapter CRUD function
live sandbox (with erroneous line commented out):
https://codesandbox.io/s/createentityadapter-demo-5rvl4
create books adapater
const booksAdapter =…

Laurence Fass
- 1,614
- 3
- 21
- 43
1
vote
1 answer
ngrx EntityState.ids.includes() expects parameter with type never
I have an Ionic Angular project with ngrx State management. Here is my State definition:
export interface State {
loaded: boolean;
loading: boolean;
invoices: InvoicesState;
invoicePositions: InvoicePositionsState;
selectedInvoice:…

Yevhenii Bahmutskyi
- 1,561
- 3
- 20
- 38
1
vote
2 answers
Nested Data Normalization createEntityAdapter
I am trying to normalize an array of data of the following structure Array. using the createEntityAdapter.
After fetching the data with a createAsyncThunk and returning them, I did set them in the extraReducers like…

Georgios
- 861
- 2
- 12
- 30
1
vote
0 answers
Redux-toolkit createEntityAdapter
The following code works as intended. The state gets populated using the createEntityAdapter.
import { createSlice, createAsyncThunk, createEntityAdapter } from '@reduxjs/toolkit';
export const fetchUsers = createAsyncThunk('users/fetchUsers',…

Wasteland
- 4,889
- 14
- 45
- 91
0
votes
1 answer
Is there any need to use normalised state with createEntityAdapter while using RTK Query?
I recently started using RTK Query and I've seen on the advanced patterns of the documentation they talked a lot about state normalisation by using createEntityAdapter and using that kind of a normalised state {ids: [1,2,3], entities: {1: {..}, 2:…

AIMEUR Amin
- 320
- 1
- 19