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

Await rendering of Xircuits diagram before saving #290

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

treo
Copy link
Contributor

@treo treo commented Feb 9, 2024

Description

After the Jupyter Lab 4 migration, we've noticed that on slower machines sometimes the creation of a new Xircuits file resulted in a 0 byte file instead of creating a minimal xircuits diagram.

The reason was that the context promise now resolves before the diagram is initially rendered.
By awaiting the rendering of the diagram we ensure that the model is properly populated before we save it.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

1. Reproduction

1. In developer tools set CPU performance to 6x slowdown
2. Create a new Xircuits file
3. Before the fix: In most cases (~80%) it can be observed that the created file has 0 bytes
4. After the fix: The created file always has more than 0 bytes

Tested on?

  • Windows
  • Linux Ubuntu
  • Centos
  • Mac
  • Others (State here -> xxx )

Await the resolution of the diagrams' renderPromise, instead of only waiting for the context's ready promise to resovle.
@treo treo requested a review from MFA-X-AI February 9, 2024 10:46
Copy link
Member

@MFA-X-AI MFA-X-AI left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request!
This bug has been a major blocker for our 3.10 release, happy to see it squashed.
Can confirm it works, merging!

@MFA-X-AI MFA-X-AI merged commit 2640680 into master Feb 9, 2024
8 checks passed
@MFA-X-AI MFA-X-AI deleted the paul/jupyter-4-new-file-bug branch February 9, 2024 12:36
treo added a commit that referenced this pull request Feb 22, 2024
…initial file

In #290 we changed the promise we wait for, thinking that rendering will always happen after the context is ready. It turns out to be wrong when running with a remote setup. 

This change now requires that both of these promises are ready.
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