Changeset View
Changeset View
Standalone View
Standalone View
web/push-notif/push-notifs-handler.js
- This file was added.
// @flow | |||||
import * as React from 'react'; | |||||
import electron from '../electron.js'; | |||||
function PushNotificationsHandler(): React.Node { | |||||
ashoat: Is there a reason this needs to be in a React component? What if we just called this from the… | |||||
michalAuthorUnsubmitted Done Inline ActionsWhile right now it's just using global objects, in the later diffs there are react hooks added inside this component. michal: While right now it's just using global objects, in the later diffs there are react hooks added… | |||||
React.useEffect(() => { | |||||
(async () => { | |||||
if (!navigator.serviceWorker || electron) { | |||||
return; | |||||
} | |||||
await navigator.serviceWorker.register('/worker/notif', { scope: '/' }); | |||||
})(); | |||||
// eslint-disable-next-line react-hooks/exhaustive-deps | |||||
ashoatUnsubmitted Not Done Inline ActionsJust wondering... what does ESLint think is missing here? Based on my intuition about this ESLint rule, I would guess it thinks navigator and electron are both global/imported so don't need to be in the dep list ashoat: Just wondering... what does ESLint think is missing here? Based on my intuition about this… | |||||
michalAuthorUnsubmitted Done Inline ActionsSorry, I just forgot to put this in the correct diff when splitting this into multiple diffs. I'm going to move it the diffs that need this annotation. michal: Sorry, I just forgot to put this in the correct diff when splitting this into multiple diffs. | |||||
}, []); | |||||
return null; | |||||
} | |||||
export { PushNotificationsHandler }; |
Is there a reason this needs to be in a React component? What if we just called this from the global scope?