[bug] `LISTENER_RESPONSE` does not update `ordered`
See original GitHub issueDo you want to request a feature or report a bug?
bug
What is the current behavior?
When received action @@reduxFirestore/LISTENER_RESPONSE
, the doc was already loaded and storeAs
is set, only data
got updated, not ordered
.
What is the expected behavior?
Expect both ordered
and data
to be updated.
Which versions of dependencies, and which browser are affected by this issue? Did this work in previous versions or setups?
redux-firestore@^0.5:
version "0.5.0"
react-redux-firebase@^2.1:
version "2.1.0"
Steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar. Listener setup:
collection(pin): "discussions"
doc(pin): "5aed4e0740133e2af516db07"
storeAs(pin): "discussionById_5aed4e0740133e2af516db07"
Received action:
{
type: '@@reduxFirestore/LISTENER_RESPONSE',
meta: {
collection: 'discussions',
doc: '5aed4e0740133e2af516db07',
storeAs: 'discussionById_5aed4e0740133e2af516db07'
},
payload: {
data: {
'5aed4e0740133e2af516db07': {
text: '123',
id: '5aed4e0740133e2af516db07',
}
},
ordered: [
{
id: '5aed4e0740133e2af516db07',
text: '123',
}
]
},
merge: {}
}
RFF config:
userProfile: 'users',
attachAuthIsReady: true,
presence: false,
useFirestoreForProfile: true,
logListenerError: true,
oneListenerPerPath: true,
enableLogging: true,
Failing test
it.only('updates doc under storeAs', () => {
action = {
type: actionTypes.LISTENER_RESPONSE,
meta: {
collection: 'testing',
doc: '123abc',
storeAs: 'pathName',
},
payload: {
ordered: [
{
content: 'new',
},
],
},
merge: {},
};
state = {
pathName: [
{
id: '123abc',
content: 'old',
},
],
};
expect(orderedReducer(state, action)).to.have.nested.property(
`pathName.0.content`,
'new',
);
});
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Bug with listeners and events · Issue #328 · owen-it/laravel ...
The update event does not exist by default, only updating and updated . Also, the tests I did with created and updated in...
Read more >Why React doesn't update state immediately - LogRocket Blog
State updates in React are asynchronous; when an update is requested, there is no guarantee that the updates will be made immediately.
Read more >"A listener indicated an asynchronous response by returning ...
The issue you are facing is this: background script does not invoke sendResponse() for one/more messages it received and went inactive (causing ...
Read more >Backbone.js
Please do not update changed directly since its state is internally maintained by set. A copy of changed can be acquired from changedAttributes....
Read more >Using XMLHttpRequest - Web APIs | MDN
Note: You need to add the event listeners before calling open() on the request. Otherwise the progress events will not fire.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in
v0.5.1
. The test you provided was also included (thanks!).Reach out if things don’t work as expected.
My issue above was caused by a typo in the reducer import. Fixed by commit 00b4190, fa7f7f6 and 3be76ec.