Skip to content

Fix regression where Vello doesn't render new document opened after closing all documents#3849

Open
Keavon wants to merge 2 commits intomasterfrom
fix-3817
Open

Fix regression where Vello doesn't render new document opened after closing all documents#3849
Keavon wants to merge 2 commits intomasterfrom
fix-3817

Conversation

@Keavon
Copy link
Member

@Keavon Keavon commented Mar 3, 2026

Fixes #3817, a regression introduced in #3722.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical rendering regression where Vello failed to display newly opened documents after all previous documents had been closed. The fix ensures that the canvas cache is properly cleared upon activating a new document, preventing stale rendering data from being used and guaranteeing a fresh visual state for the user.

Highlights

Changelog
  • editor/src/messages/portfolio/portfolio_message_handler.rs
    • Added a call to self.executor.clear_canvas_cache() when a new document is set as active.
  • editor/src/node_graph_executor.rs
    • Implemented a new public function clear_canvas_cache which sets self.last_svg_canvas to None.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request effectively addresses the regression where Vello failed to render new documents after closing all previous ones. The addition of clear_canvas_cache() in NodeGraphExecutor and its invocation within PortfolioMessageHandler::SelectDocument correctly ensures that the rendering state is reset, allowing for proper rendering of newly opened documents. The changes are well-encapsulated and directly target the identified issue, improving the stability of the application's rendering pipeline.

@Keavon
Copy link
Member Author

Keavon commented Mar 3, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a rendering regression with Vello when opening a new document after all others are closed. The changes involve removing a caching mechanism for SVG canvas frames on the backend, which was likely causing stale data to be used. On the frontend, a guard has been added to prevent unnecessarily replacing an already-mounted viewport canvas. My review includes a suggestion to improve the maintainability of SVG string construction in the backend.

Comment on lines 386 to 391
let matrix = format_transform_matrix(frame.transform);
let transform = if matrix.is_empty() { String::new() } else { format!(" transform=\"{matrix}\"") };
let svg = format!(
r#"<svg><foreignObject width="{}" height="{}"{transform}><div data-canvas-placeholder="{}" data-is-viewport="true"></div></foreignObject></svg>"#,
frame.resolution.x, frame.resolution.y, frame.surface_id.0,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current method of constructing the transform attribute by including a leading space in the string is a bit fragile. If the space is accidentally removed during future refactoring, it would result in invalid SVG. A more explicit approach using an if/else block to construct the SVG string with or without the transform attribute would be more robust and easier to maintain.

let matrix = format_transform_matrix(frame.transform);
let svg = if matrix.is_empty() {
	format!(
		r#"<svg><foreignObject width="{}" height="{}"><div data-canvas-placeholder="{}" data-is-viewport="true"></div></foreignObject></svg>"#,
		frame.resolution.x, frame.resolution.y, frame.surface_id.0
	)
} else {
	format!(
		r#"<svg><foreignObject width="{}" height="{}" transform="{}"><div data-canvas-placeholder="{}" data-is-viewport="true"></div></foreignObject></svg>"#,
		frame.resolution.x, frame.resolution.y, matrix, frame.surface_id.0
	)
};

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.

New document > close it > new document > the artboard doesn't render

1 participant