Skip to content

Conversation

luke-quadratic
Copy link
Contributor

This PR is purely for prototyping/experimentation.

Copy link

qa-wolf bot commented Sep 11, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@cla-bot cla-bot bot added the cla-signed label Sep 11, 2025
Copy link
Contributor

github-actions bot commented Sep 11, 2025

Preview - Build, Deploy & Tests-E2E

✅ Build images
✅ Deploy images - Sep 12, 2025 at 12:34 AM UTC - Preview
❌ Tests-E2E - Report

@github-actions github-actions bot temporarily deployed to preview-pr-3442 September 11, 2025 21:18 Destroyed
Copy link

codecov bot commented Sep 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.71%. Comparing base (872b55d) to head (514e051).

Additional details and impacted files
@@           Coverage Diff           @@
##               qa    #3442   +/-   ##
=======================================
  Coverage   89.71%   89.71%           
=======================================
  Files         434      434           
  Lines       89063    89063           
=======================================
  Hits        79906    79906           
  Misses       9157     9157           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot temporarily deployed to preview-pr-3442 September 11, 2025 21:28 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-3442 September 11, 2025 21:39 Destroyed
@github-actions github-actions bot temporarily deployed to preview-pr-3442 September 11, 2025 23:00 Destroyed

// Handle window resize to recalculate height if needed
const handleResize = () => {
setTimeout(adjustHeight, 0); // Use setTimeout to ensure DOM is updated
Copy link
Contributor

Choose a reason for hiding this comment

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

Timer leak: setTimeout(adjustHeight, 0) is called in the resize handler but the timeout ID is not stored or cleared. If the component unmounts while the timeout is pending, the timeout will still execute and call adjustHeight() on an unmounted component, potentially causing errors.

Suggested change
setTimeout(adjustHeight, 0); // Use setTimeout to ensure DOM is updated
const timeoutId = setTimeout(adjustHeight, 0); // Use setTimeout to ensure DOM is updated
return () => clearTimeout(timeoutId); // Clean up timeout if component unmounts

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +291 to +293
requestAnimationFrame(() => {
adjustHeight();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Timer leak: requestAnimationFrame() is called but the frame ID is not stored or cleared. If the component unmounts while the animation frame is pending, it will still execute and call adjustHeight() on an unmounted component, potentially causing errors.

Suggested change
requestAnimationFrame(() => {
adjustHeight();
});
const rafId = requestAnimationFrame(() => {
adjustHeight();
});
return () => {
cancelAnimationFrame(rafId);
};

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@github-actions github-actions bot temporarily deployed to preview-pr-3442 September 12, 2025 00:17 Destroyed
private summaries = new Map<string, CodeCellSummary>();
private readonly STORAGE_KEY = 'quadratic_ai_code_cell_summaries';
private readonly MAX_SUMMARIES = 1000; // Limit to prevent memory issues
private saveTimeoutId: NodeJS.Timeout | null = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Timer leak vulnerability: saveTimeoutId is declared as NodeJS.Timeout but in browser environments, setTimeout returns a number. This type mismatch can cause clearTimeout to fail silently, leading to timer leaks and potential memory issues. Change type to number | null for browser compatibility.

Suggested change
private saveTimeoutId: NodeJS.Timeout | null = null;
private saveTimeoutId: number | NodeJS.Timeout | null = null;

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

const { x, y } = cursor;

// First check if this cell has an AI summary
const aiSummary = aiCodeCellSummaryStore.getSummary(sheets.current, x, y);
Copy link
Contributor

Choose a reason for hiding this comment

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

Cache invalidation bug: getSummary() is called without the currentCodeString parameter, so cache validation is skipped. This means outdated AI summaries will be displayed even when the code has changed. Pass the current code string to enable proper cache validation.

Suggested change
const aiSummary = aiCodeCellSummaryStore.getSummary(sheets.current, x, y);
const aiSummary = aiCodeCellSummaryStore.getSummary(sheets.current, x, y, currentCodeString);

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed prototype exploring an idea that can be played with

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant