-
Notifications
You must be signed in to change notification settings - Fork 41
fix(bug): visualization not being rendered correctly in PDF delivery schedule fix #71
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
base: master
Are you sure you want to change the base?
fix(bug): visualization not being rendered correctly in PDF delivery schedule fix #71
Conversation
It appears that the visualization is prematurely notifying the PDF rendering that the visualization has completed rendering. This fix adds waits to make sure all promises have finished before calling done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @elivillalejos, 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 addresses a critical bug where visualizations, specifically report tables, were not rendering correctly on subsequent pages when dashboards were scheduled for PDF delivery, resulting in blank pages. The changes primarily involve updating the visualization's rendering logic to properly handle asynchronous operations, ensuring that all rendering steps complete before the visualization signals its readiness, thereby resolving the blank page issue in PDF exports.
Highlights
- Asynchronous Rendering: The
buildReportTable
function has been converted to anasync
function to better manage asynchronous operations within the rendering process, which is crucial for ensuring complete visualization rendering, especially in PDF exports. - Improved Timing for Styles: The
removeStyles
function call is nowawait
ed, ensuring that previous styles are fully removed before new themes or custom styles are applied. This prevents potential rendering conflicts and ensures correct styling. - Synchronized Table Rendering: The
renderTable
function call is also nowawait
ed, guaranteeing that the table content is fully rendered before the 'reveal' class is added and the SVG element is made visible. This addresses the issue of incomplete rendering. - Proper Completion Signaling: The
done()
callback, which signals the visualization's completion to the Looker platform, is now placed within a.finally()
block. This ensures thatdone()
is always called afterbuildReportTable
has finished executing, regardless of success or failure, which is crucial for reliable PDF generation and preventing blank pages.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
There was a problem hiding this 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 addresses a bug where visualizations were not rendering correctly in scheduled PDF deliveries. The root cause appears to be a race condition, which you've fixed by correctly handling asynchronous operations using async/await
and promise chaining.
The changes to make buildReportTable
an async
function and await
the removeStyles
and renderTable
calls are spot on. Calling the done()
callback within a .finally()
block is also the correct approach to ensure it runs after the rendering is complete.
I've added a couple of suggestions to improve code clarity and error handling. Great work on fixing this tricky bug!
.catch(error => { | ||
console.error(error); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good that you're catching errors from buildReportTable
. However, just logging to the console might not be visible to end-users. It would be more robust to use this.addError
to display a user-friendly error in the visualization, similar to how other errors are handled in this component.
.catch(error => {
console.error(error);
this.addError({
title: 'Error building report table',
message: error.message,
});
})
While scheduling a dashboard as PDF, the second page appears in blank.