Skip to content

Fixes "event.sender.send is not a function"#1214

Merged
araujoarthur0 merged 3 commits into
TTLApp:mainfrom
Atomic-Germ:fix/1162
Jan 6, 2026
Merged

Fixes "event.sender.send is not a function"#1214
araujoarthur0 merged 3 commits into
TTLApp:mainfrom
Atomic-Germ:fix/1162

Conversation

@Atomic-Germ

@Atomic-Germ Atomic-Germ commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

Related issue

Closes #1162

Context / Background

This one has been an issue for a long time now. Here's what I've figured out. The whole time, we've been trying to use sender.send, which is part of the main process. What we needed to be using was the ipcRenderer.send, but that presented its own issues. It turns out a change in the preload js allows ipcRenderer.send to work.

What change is being introduced by this PR?

  • How did you approach this problem?

    • Refactoring and using the ipcrenderer instead of main
  • What changes did you make to achieve the goal?

    • Refactored notification-channel.js to use the renderer process API
    • Exposed the needed bits of the api in renderer-api preload
    • Updated the test
  • What are the indirect and direct consequences of the change?
    The notifications work now, and the event.sender.send is not a function is gone.

How will this be tested?

Standard tests should pass and the method for reproducing #1162 should fail.

@codecov

codecov Bot commented Jun 6, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@araujoarthur0

Copy link
Copy Markdown
Collaborator

Please add a meaningful self-descriptive name to the PR.

Comment thread renderer/preload-scripts/calendar-bridge.mjs Outdated
@Atomic-Germ Atomic-Germ changed the title Fix/1162 Fixes "event.sender.send is not a function" Jun 7, 2025
@araujoarthur0

Copy link
Copy Markdown
Collaborator

That's a better name. It's good to have PR titles that give us an idea of what's being fixed just by reading it. The numbers don't mean anything to a reader

Comment thread renderer/notification-channel.js Outdated

contextBridge.exposeInMainWorld(
'rendererApi', rendererApi
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated change

send: (channel, value) =>
for (let i = 0; i < 2; i++)
{
$('body').append(`<input id="leave-by" value="${i}${i}:${i}${i}" />`);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is being appended inside the for-loop, I imagine the body ends up with 2 leave-by elements as the cleanup happens only before it()

@tupaschoal
tupaschoal requested a review from araujoarthur0 July 12, 2025 09:33
@Atomic-Germ
Atomic-Germ marked this pull request as draft July 21, 2025 21:35
@Atomic-Germ
Atomic-Germ force-pushed the fix/1162 branch 2 times, most recently from dc4df85 to 5e771d7 Compare August 12, 2025 21:34
@tupaschoal

Copy link
Copy Markdown
Collaborator

@araujoarthur0 will you please take a look? :)

@Atomic-Germ
Atomic-Germ marked this pull request as ready for review August 25, 2025 22:20
Comment thread js/time-math.mjs
* Validates that a string is a valid time, following the format of HH:MM
* @returns true if it's valid
*/
static validateTime(time)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this function have been used in searchLeaveByElement?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I don't know why I didn't consider that, good call.

Comment thread __tests__/__renderer__/notification-channel.mjs
Comment thread js/notification.mjs Outdated
const timeDate = new Date();
timeDate.setHours(Number(hours), Number(minutes), 0, 0);
const localizedTime = timeDate.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' });
const message = i18NextConfig.getCurrentTranslation('$Notification.time-to-leave', { time: localizedTime });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this message have a placeholder where time gets used? I didn't see one in the English file.

@araujoarthur0 araujoarthur0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just some small items

Atomic-Germ added a commit to Atomic-Germ/time-to-leave that referenced this pull request Nov 20, 2025
	modified:   __tests__/__renderer__/notification-channel.mjs
	modified:   js/notification.mjs
	modified:   js/time-math.mjs
	modified:   renderer/notification-channel.js
	modified:   renderer/preload-scripts/renderer-api.mjs
Signed-off-by: Casey Parker <02-germane-atomic@icloud.com>
	modified:   __tests__/__renderer__/notification-channel.mjs
	modified:   js/notification.mjs
	modified:   js/time-math.mjs
	modified:   renderer/notification-channel.js
	modified:   renderer/preload-scripts/renderer-api.mjs
@tupaschoal

Copy link
Copy Markdown
Collaborator

@araujoarthur0 are you ok with the current revision?

@araujoarthur0
araujoarthur0 merged commit 8379176 into TTLApp:main Jan 6, 2026
4 checks passed
@tupaschoal

Copy link
Copy Markdown
Collaborator

\changelog-update
Message: Fix [#1162]: Notifications failing with "event.sender.send is not a function"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notifications failing "event.sender.send is not a function"

3 participants