Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't clear user data first time realmRelease is null #1868

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,20 @@ export const bootRealm = () => {
const storedRealmRelease = store.get('realmRelease');
const currentRealmRelease = app.getVersion();

if (storedRealmRelease !== currentRealmRelease) {
if (
Boolean(storedRealmRelease) &&
storedRealmRelease !== currentRealmRelease
) {
// If the stored realmRelease is different from the current realmRelease,
// it means the user has had Realm uninstalled for a while and is now
// reinstalling it, since it otherwise would have been updated by AppUpdater.
// In this case, we want to clear the user data.
log.info('Booting a Realm version different from stored user data.');
log.info(
'Booting a Realm version different from stored user data:',
storedRealmRelease,
'vs.',
currentRealmRelease
);
clearUserData();
} else {
log.info('Booting a Realm version compatible with stored user data.');
Expand Down