Skip to content

Commit

Permalink
clean up callback
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Feb 16, 2024
1 parent d0d4c4b commit 099e1d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/src/redux/shell/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export function appShellRequestor<Data>(
export function appShellListener(
hostname: string | null,
topic: NotifyTopic,
listenerCb: (data: NotifyResponseData) => void
callback: (data: NotifyResponseData) => void
): void {
remote.ipcRenderer.on(
'notify',
(_, shellHostname, shellTopic, shellMessage) => {
if (hostname === shellHostname && topic === shellTopic) {
listenerCb(shellMessage)
callback(shellMessage)

Check warning on line 49 in app/src/redux/shell/remote.ts

View check run for this annotation

Codecov / codecov/patch

app/src/redux/shell/remote.ts#L49

Added line #L49 was not covered by tests
}
}
)
Expand Down
3 changes: 1 addition & 2 deletions app/src/resources/useNotifyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export function useNotifyService<TData, TError = Error>({
hostname != null &&
staleTime !== Infinity
) {
const listenerCb = (data: NotifyResponseData): void => onDataEvent(data)
appShellListener(hostname, topic, listenerCb)
appShellListener(hostname, topic, onDataEvent)

Check warning on line 49 in app/src/resources/useNotifyService.ts

View check run for this annotation

Codecov / codecov/patch

app/src/resources/useNotifyService.ts#L49

Added line #L49 was not covered by tests
dispatch(notifySubscribeAction(hostname, topic))

return () => {
Expand Down

0 comments on commit 099e1d3

Please sign in to comment.