question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] `LISTENER_RESPONSE` does not update `ordered`

See original GitHub issue

Do 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.

image

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:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
prescottpruecommented, May 6, 2018

Fixed in v0.5.1. The test you provided was also included (thanks!).

Reach out if things don’t work as expected.

0reactions
mattvickcommented, Apr 14, 2019

My issue above was caused by a typo in the reducer import. Fixed by commit 00b4190, fa7f7f6 and 3be76ec.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found