Skip to content

Commit

Permalink
Search: fix Tracks value that is causing event to be rejected (#38394)
Browse files Browse the repository at this point in the history
* Search: Fix jetpack_search_customberg_save_button_click event properties

* changelog

* Fix project version
  • Loading branch information
IanRamosC authored Jul 18, 2024
1 parent e7b1ef5 commit 3a1eb8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: This commit fixes the property of a Tracks event that was being sent as a JSON, which is not a valid Tracks value.


Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import useEntityRecordState from 'hooks/use-entity-record-state';
import { SERVER_OBJECT_NAME } from 'instant-search/lib/constants';
import { eventPrefix, recordEvent } from 'lib/analytics';
import './styles.scss';

Expand All @@ -11,22 +10,13 @@ import './styles.scss';
* @returns {Element} component instance
*/
export default function SaveButton() {
const {
editedEntities: editedSettings,
isSaving,
hasUnsavedEdits,
saveRecords,
} = useEntityRecordState();
const { isSaving, hasUnsavedEdits, saveRecords } = useEntityRecordState();

const onClick = ( ...args ) => {
if ( isSaving ) {
return;
}
recordEvent( `${ eventPrefix }_save_button_click`, {
initialSettings: JSON.stringify( window[ SERVER_OBJECT_NAME ].overlayOptions ),
changedSettings: JSON.stringify( editedSettings ),
changedSettingNames: Object.keys( editedSettings ).join( ',' ),
} );
recordEvent( `${ eventPrefix }_save_button_click` );
saveRecords( ...args );
};

Expand Down

0 comments on commit 3a1eb8b

Please sign in to comment.