Skip to content

Comments

⚡ Bolt: Optimize viewPDF data passing#13

Open
MrAlokTech wants to merge 1 commit intomainfrom
bolt-viewpdf-optimization-15032396959821715366
Open

⚡ Bolt: Optimize viewPDF data passing#13
MrAlokTech wants to merge 1 commit intomainfrom
bolt-viewpdf-optimization-15032396959821715366

Conversation

@MrAlokTech
Copy link
Owner

💡 What: Refactored viewPDF to accept a string ID and look up the PDF object. Updated createPDFCard to use data-id and pass this.dataset.id to viewPDF.

🎯 Why: Serializing the entire PDF object into the HTML onclick handler was inefficient (O(N) string operations) and bloated the DOM. It also posed potential escaping issues for special characters in the data.

📊 Impact: Reduces string concatenation and DOM size significantly. Improves rendering performance for large lists.

🔬 Measurement: Verified with a Playwright script that the modal still opens correctly with the correct data.


PR created automatically by Jules for task 15032396959821715366 started by @MrAlokTech

Optimized the `createPDFCard` function to pass the PDF ID via `data-id` attribute instead of serializing the entire PDF object into the `onclick` handler. This reduces DOM size and rendering time, and improves security by avoiding complex string escaping in inline handlers.

Updated `viewPDF` to accept a string ID and look up the PDF object from the global `pdfDatabase`.

Co-authored-by: MrAlokTech <107493955+MrAlokTech@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@cloudflare-workers-and-pages
Copy link

Deploying classnotes with  Cloudflare Pages  Cloudflare Pages

Latest commit: df202b2
Status: ✅  Deploy successful!
Preview URL: https://73ac0524.classnotes.pages.dev
Branch Preview URL: https://bolt-viewpdf-optimization-15.classnotes.pages.dev

View logs

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.

1 participant