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

Adding some communication between UI and backend to ensure sync at connection start #164

Merged
merged 12 commits into from Aug 24, 2022

Conversation

Apokalip
Copy link
Contributor

@Apokalip Apokalip commented Aug 10, 2022

Signed-off-by: Apokalip simeon@manta.network

Add invoke and static bool to track when front end is ready.

Changing how connection event happens, so until now we were sending a single connect event when the back end was ready to connect. There are a few issues with that as Rust code in release would probably be faster than the JS code which may send the connect event before the UI is listening for it. This was happening in the Linux Freezing #91. There are Tauri issues from other devs with the same problem with syncing at the start of the App, but Tauri was just not planned to be used as this, as normally you can work with the UI without being fully in sync with the backend. In some of those issues Tauri devs mention they are working on a solution but for now we are using a normal pinging method. What we are changing is instead of sending connect event once, we start emitting continuously connection events until we get an answer from the UI, in this case invoking ui_connected() and tracking UI_CONNECTED state. If connected we stop emitting or if not we timeout of course.

This should work in all cases, as we know the UI will always wait at

await once('connect', (event) => {
for the connect event, then we just invoke the ui_connected to signal the backend that the UI is connected and we can continue normally.

Old:
This is caused by misuse of how Tauri works. In this case we are trying to control the UI from the "back-end". While you would want the Rust code to generate the Front end, but after that the front end needs to "control" the backend by invoking methods and reacting to events as a UI should. For now this will work properly as this is not a workaround. But if we want to scale this, it is recommended to be changed as mentioned above.

fixes: #146
fixes: #91


Before we can merge this PR, please make sure that all the following items have been checked off:

  • Linked to an issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Added one line describing your change in CHANGELOG.md and added the appropriate changelog label to the PR.
  • Re-reviewed Files changed in the GitHub PR explorer.

Signed-off-by: Apokalip <simeon@manta.network>
@vercel
Copy link

vercel bot commented Aug 10, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
manta-signer ✅ Ready (Inspect) Visit Preview Aug 24, 2022 at 9:28PM (UTC)

Signed-off-by: Apokalip <simeon@manta.network>
Signed-off-by: Apokalip <simeon@manta.network>
Kevingislason
Kevingislason previously approved these changes Aug 10, 2022
ui/src-tauri/src/main.rs Outdated Show resolved Hide resolved
Signed-off-by: Apokalip <simeon@manta.network>
Kevingislason
Kevingislason previously approved these changes Aug 10, 2022
…at the start

Signed-off-by: Apokalip <simeon@manta.network>
@Apokalip Apokalip changed the title Adding invoke to track when front end is ready Adding some communication between UI and backend to ensure sync at connection start Aug 18, 2022
@Apokalip Apokalip requested review from Kevingislason and removed request for dp3000 August 18, 2022 14:35
Signed-off-by: Apokalip <simeon@manta.network>
Kevingislason
Kevingislason previously approved these changes Aug 18, 2022
@Apokalip Apokalip added the C-bug Category: Issues documenting a bug label Aug 19, 2022
@Apokalip Apokalip added L-added Changelog: add these changes to the `added` section of the changelog A-ui Area: Issues and PRs related to UI labels Aug 19, 2022
Signed-off-by: Apokalip <simeon@manta.network>
Kevingislason
Kevingislason previously approved these changes Aug 24, 2022
Signed-off-by: Simeon Zahariev <43317481+Apokalip@users.noreply.github.com>
@bhgomes bhgomes added L-fixed Changelog: add these changes to the `fixed` section of the changelog and removed L-added Changelog: add these changes to the `added` section of the changelog labels Aug 24, 2022
Signed-off-by: Brandon H. Gomes <bhgomes@pm.me>
@bhgomes bhgomes merged commit 30b8780 into main Aug 24, 2022
@bhgomes bhgomes deleted the Apokalip/freezing_bug_fix_invoke_sync branch August 24, 2022 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ui Area: Issues and PRs related to UI C-bug Category: Issues documenting a bug L-fixed Changelog: add these changes to the `fixed` section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signer freezes unpredictably on startup Linux - Signer stuck at loading
3 participants