realm / realm-studio

Realm Studio
https://realm.io/products/realm-studio/
Apache License 2.0
302 stars 41 forks source link

Delete user results in an empty screen #848

Closed cmelchior closed 6 years ago

cmelchior commented 6 years ago

Studio: 2.2.0

To Reproduce 1) Log into a ROS instance 2) Select Users 3) Select a User and press delete 4) The window now goes blank instead of showing the list of users

image

image

cmelchior commented 6 years ago

This seems to be connected with the user having Realms. I tried to delete a user with no Realms which worked fine. If the user had a partial Realm, the screen went blank.

kraenhansen commented 6 years ago

Thanks discovering + reporting this. It is most probably an issue that can be fixed by checking isValid() before accessing a users list of Realms, like https://github.com/realm/realm-studio/pull/803.

realm-studio-bot commented 6 years ago

Sentry issue: REALM-STUDIO-X

realm-studio-bot commented 6 years ago

Sentry issue: REALM-STUDIO-2Y

cmelchior commented 6 years ago

This is the crash:

ELECTRON] Error: Accessing object of type User which has been invalidated or deleted
[ELECTRON]     at ./src/ui/ServerAdministration/UsersTable/UsersTable.tsx.exports.UsersTable (http://localhost:8080/renderer.bundle.js:14304:343)
[ELECTRON]     at updateFunctionalComponent (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:13017:20)
[ELECTRON]     at beginWork (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:13713:14)
[ELECTRON]     at performUnitOfWork (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:15741:12)
[ELECTRON]     at workLoop (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:15780:24)
[ELECTRON]     at renderRoot (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:15820:7)
[ELECTRON]     at performWorkOnRoot (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:16437:22)
[ELECTRON]     at performWork (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:16358:7)
[ELECTRON]     at performSyncWork (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:16330:3)
[ELECTRON]     at requestWork (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:16230:5)
[ELECTRON]     at scheduleWork$1 (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:16096:11)
[ELECTRON]     at Object.enqueueSetState (/Users/cm/Realm/realm-studio/node_modules/react-dom/cjs/react-dom.development.js:11185:5)
[ELECTRON]     at ServerAdministrationContainer.Component.setState (/Users/cm/Realm/realm-studio/node_modules/react/cjs/react.development.js:273:16)
[ELECTRON]     at Realm.ServerAdministrationContainer.onRealmChanged (http://localhost:8080/renderer.bundle.js:14583:18)

I tried to look into it, but I don't think I understand how the UserTable component work, because no matter I did, the crash keeps appearing. It looks like the component somehow caches some data even though it is told to re-render it based on the new (correct) user list.