Skip to content

Commit 2ef073f

Browse files
committed
refactor: use window not globalThis
Signed-off-by: Adam Setch <[email protected]>
1 parent d959814 commit 2ef073f

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/renderer/__helpers__/jest.setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import '@primer/react/test-helpers';
1010
/**
1111
* Gitify context bridge API
1212
*/
13-
globalThis.gitify = {
13+
window.gitify = {
1414
app: {
1515
version: jest.fn().mockResolvedValue('v0.0.1'),
1616
hide: jest.fn(),

src/renderer/context/App.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
108108
const [needsAccountRefresh, setNeedsAccountRefresh] = useState(false);
109109

110110
const {
111-
removeAccountNotifications,
112-
fetchNotifications,
113111
notifications,
114-
globalError,
112+
fetchNotifications,
113+
removeAccountNotifications,
115114
status,
115+
globalError,
116116
markNotificationsAsRead,
117117
markNotificationsAsDone,
118118
unsubscribeNotification,
@@ -234,7 +234,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
234234
}, [settings.openAtStartup]);
235235

236236
useEffect(() => {
237-
globalThis.gitify.onResetApp(() => {
237+
window.gitify.onResetApp(() => {
238238
clearState();
239239
setAuth(defaultAuth);
240240
setSettings(defaultSettings);
@@ -276,9 +276,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
276276
// biome-ignore lint/correctness/useExhaustiveDependencies: We want to update on settings.zoomPercentage changes
277277
useEffect(() => {
278278
// Set the zoom level when settings.zoomPercentage changes
279-
globalThis.gitify.zoom.setLevel(
280-
zoomPercentageToLevel(settings.zoomPercentage),
281-
);
279+
window.gitify.zoom.setLevel(zoomPercentageToLevel(settings.zoomPercentage));
282280

283281
// Sync zoom percentage in settings when window is resized
284282
let timeout: NodeJS.Timeout;
@@ -288,7 +286,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
288286
clearTimeout(timeout);
289287
timeout = setTimeout(() => {
290288
const zoomPercentage = zoomLevelToPercentage(
291-
globalThis.gitify.zoom.getLevel(),
289+
window.gitify.zoom.getLevel(),
292290
);
293291

294292
updateSetting('zoomPercentage', zoomPercentage);

0 commit comments

Comments
 (0)