Skip to content

Fix stale database data after saving charts#1335

Open
lucadobrescu wants to merge 2 commits into
developmentfrom
fix/1329-database-source-save
Open

Fix stale database data after saving charts#1335
lucadobrescu wants to merge 2 commits into
developmentfrom
fix/1329-database-source-save

Conversation

@lucadobrescu

Copy link
Copy Markdown

Summary

  • Save active database query data before the main chart form closes, keeping one-time imports aligned with the latest preview.
  • Add a focused Playwright regression and test-only database-source enablement.

Closes #1329

Test plan

  • npm run test:e2e:playwright -- tests/e2e/specs/database-source.spec.js
  • npx wp-scripts lint-js tests/e2e/specs/database-source.spec.js
  • vendor/bin/phpcs --standard=phpcs.xml tests/e2e/config/enable-database-source.php
  • JavaScript/PHP syntax and git diff --check

Save the active database query before the chart form closes so one-time imports cannot retain stale preview data.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 10, 2026
@pirate-bot

pirate-bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Plugin build for 58130b5 is ready 🛎️!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the classic chart editor to persist database-query snapshots before saving, with E2E regression coverage.

Changes:

  • Saves active database-query data before closing the editor.
  • Adds cookie-gated database-source test support.
  • Adds a Playwright regression test for stale one-time imports.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
js/frame.js Coordinates database and chart saves.
tests/e2e/specs/database-source.spec.js Tests refreshed query data persistence.
tests/e2e/config/enable-database-source.php Enables database-source functionality during E2E tests.
.wp-env.json Loads the E2E helper as an MU plugin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread js/frame.js Outdated
Comment on lines +482 to +494
$( '#settings-button' ).on( 'click', function( event ){
$('body').trigger('visualizer:db:query:update', {});
if( $( '#db-chart-button' ).attr( 'data-current' ) !== 'filter' || $( '.visualizer-db-query' ).val().length === 0 ){
return;
}

event.preventDefault();
event.stopImmediatePropagation();
$( '#thehole' ).one( 'load', function(){
$( '#settings-button' ).trigger( 'click' );
} );
$( '#db-chart-button' ).trigger( 'click' );
} );
Comment thread js/frame.js Outdated
Comment on lines +490 to +492
$( '#thehole' ).one( 'load', function(){
$( '#settings-button' ).trigger( 'click' );
} );
Comment thread tests/e2e/config/enable-database-source.php Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants