Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make core api client initialization synchronous #77

Merged
merged 6 commits into from
Jan 7, 2025

Conversation

achou11
Copy link
Member

@achou11 achou11 commented Dec 19, 2024

Before, our setup for initializing the core api client in the renderer followed the approach documented in this Electron tutorial. In summary, the main process was responsible for creating the channel that connected the renderer with the "service" that runs core, which meant that the instantiation of the client in the renderer was asynchronous.

Instead, Gregor figured out an approach that allows the renderer to essentially immediately initialize the client, which makes the setup code more straightforward and also removes some complexity around asynchronous initialization. Also, based on my very minimal understanding, the immediate initialization of the client has the benefit of being able to queue messages sent by the renderer side (or maybe vice versa?) due to how MessageChannel ports work.

There are a couple of todo comments related to surfacing errors related to initialization but they shouldn't be blockers for this PR. That's something we don't have yet set up in general and can be done via a follow-up after some discussion about our general approach with errors.

@achou11 achou11 requested a review from gmaclennan December 19, 2024 20:49
@achou11 achou11 merged commit c7d2878 into main Jan 7, 2025
4 checks passed
@achou11 achou11 deleted the chore/comapeo-init-experiment branch January 7, 2025 18:07
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.

2 participants