score:0

Looks like you are missing writeToFirebase call, and calling then from the wrong place, try this code instead:

export const updateUserDetailsThenUpdateFirebase = updatedUser => {
  return (dispatch, getState) => {
    dispatch(updateUserDetails(updatedUser));

    writeToFirebase(updatedUser).then(() => {
      const storeData = getState();
      // ... called after firebase finishes
    });
  };
};

score:0

ah, so I was very close: amazingly, and amagically,

this works:

export const updateUserDetailsThenUpdateFirebase = updatedUser => {
  return (dispatch, getState) => {
    return dispatch(updateUserDetails(updatedUser)).then(() => {
      const foundUser = getState().selectedUser;
      const userToUpdate = getState().users.users.filter(
        user => user.id === foundUser.id
      );
      return writeToFirebase(userToUpdate, 1);
    });
  };
};

Related Query

More Query from same tag