Fix stale database data after saving charts#1335
Open
lucadobrescu wants to merge 2 commits into
Open
Conversation
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>
Contributor
Contributor
There was a problem hiding this comment.
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 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 on lines
+490
to
+492
| $( '#thehole' ).one( 'load', function(){ | ||
| $( '#settings-button' ).trigger( 'click' ); | ||
| } ); |
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1329
Test plan
npm run test:e2e:playwright -- tests/e2e/specs/database-source.spec.jsnpx wp-scripts lint-js tests/e2e/specs/database-source.spec.jsvendor/bin/phpcs --standard=phpcs.xml tests/e2e/config/enable-database-source.phpgit diff --check