Skip to content

Commit

Permalink
Fix user provider rerender
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Oct 10, 2023
1 parent fb9c9e4 commit 9103d76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/realm-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* None

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* User deletion did not rerender
* None

### Compatibility
Expand Down
4 changes: 1 addition & 3 deletions packages/realm-react/src/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ export const UserProvider: React.FC<UserProviderProps> = ({ fallback: Fallback,

useEffect(() => {
const event = () => {
if (app.currentUser?.id != user?.id) {
setUser(app.currentUser);
}
setUser(app.currentUser ? new Proxy(app.currentUser, {}) : null);
};
user?.addListener(event);
app?.addListener(event);
Expand Down

0 comments on commit 9103d76

Please sign in to comment.