Skip to content

Does not unwatch all listeners upon unmount if there are multiple listeners with different queries at the same base path. #234

Closed
@fej-snikduj

Description

@fej-snikduj

Do you want to request a feature or report a bug?
bug

What is the current behavior?
When using storeAs to create to unique queries to the same path, the listeners are not correctly unwatched upon component dismounting. The initial watching works correctly, and all functions well, until the component dismounts. Only one of the listeners is unset, and the remaining one remains on. When the component remounts, the storeAs functionality no longer works as it did upon first mounting (now only one listener is currently on).

  @firebaseConnect(({ userId1, userId2 }) => {
    const query1 = [
      'orderByChild=createdBy',
      `equalTo=${userId1}`,
    ];
    const query2 = [
      'orderByChild=assignedTo',
      `equalTo=${userId2}`,
    ];

    return [
      { path: 'todos', queryParams: query1, storeAs: 'user1Todos' },
      { path: 'todos', queryParams: query2, storeAs: 'user2Todos' },
    ];
  }

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

What is the expected behavior?
Expected behavior is to un-watch both queries upon dismount and to rewatch both upon remount.

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?
v1.4.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions