Skip to content

Commit 9aace77

Browse files
committed
Use early return
1 parent fea609e commit 9aace77

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

packages/app/src/app/overmind/onInitialize.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,26 @@ export const onInitialize: OnInitialize = async (
108108
effects.preview.initialize(overmindInstance.reaction);
109109

110110
// show terms message on first visit since new terms
111-
if (!effects.browser.storage.get(seenTermsKey) && !state.isFirstVisit) {
112-
effects.notificationToast.add({
113-
message:
114-
'Hello, our privacy policy has been updated recently. What’s new? CodeSandbox emails. Please read and reach out.',
115-
title: 'Updated Privacy',
116-
status: convertTypeToStatus('notice'),
117-
sticky: true,
118-
actions: {
119-
primary: [
120-
{
121-
label: 'Open Privacy Policy',
122-
run: () => {
123-
window.open('https://codesandbox.io/legal/privacy', '_blank');
124-
},
125-
},
126-
],
127-
},
128-
});
129-
effects.browser.storage.set(seenTermsKey, true);
111+
if (effects.browser.storage.get(seenTermsKey) || state.isFirstVisit) {
112+
return;
130113
}
114+
115+
effects.notificationToast.add({
116+
message:
117+
'Hello, our privacy policy has been updated recently. What’s new? CodeSandbox emails. Please read and reach out.',
118+
title: 'Updated Privacy',
119+
status: convertTypeToStatus('notice'),
120+
sticky: true,
121+
actions: {
122+
primary: [
123+
{
124+
label: 'Open Privacy Policy',
125+
run: () => {
126+
window.open('https://codesandbox.io/legal/privacy', '_blank');
127+
},
128+
},
129+
],
130+
},
131+
});
132+
effects.browser.storage.set(seenTermsKey, true);
131133
};

0 commit comments

Comments
 (0)