Skip to content

Commit 0a18fc5

Browse files
committed
chore: qa fixes
1 parent 9d23ec4 commit 0a18fc5

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

classes/Visualizer/Module.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,11 @@ final public function handleExistingRevisions( $chart_id, $chart ) {
487487
if ( get_post_type( $chart_id ) !== Visualizer_Plugin::CPT_VISUALIZER ) {
488488
return $chart_id;
489489
}
490+
// AI Builder (D3) charts use their own publish flow — skip the classic revision-restore
491+
// mechanism, which would otherwise overwrite the saved title and settings.
492+
if ( 'd3' === get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_LIBRARY, true ) ) {
493+
return $chart;
494+
}
490495
// undo revisions.
491496
$revisions_found = $this->undoRevisions( $chart_id, true );
492497

classes/Visualizer/Module/AIBuilder.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,17 @@ public function fetchChart(): void {
181181
wp_send_json_error( array( 'message' => __( 'Chart not found.', 'visualizer' ) ) );
182182
}
183183

184-
$series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
185-
$data = Visualizer_Module::get_chart_data( $chart, '', false );
186-
$code = get_post_meta( $chart_id, self::CF_D3_CODE, true );
184+
$series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
185+
$data = Visualizer_Module::get_chart_data( $chart, '', false );
186+
$code = get_post_meta( $chart_id, self::CF_D3_CODE, true );
187+
$settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true );
188+
$title = ( is_array( $settings ) && ! empty( $settings['backend-title'] ) )
189+
? $settings['backend-title']
190+
: $chart->post_title;
187191

188192
wp_send_json_success(
189193
array(
190-
'title' => $chart->post_title,
194+
'title' => $title,
191195
'series' => $series,
192196
'data' => $data,
193197
'code' => $code,

0 commit comments

Comments
 (0)