Skip to content

Commit

Permalink
Fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
okmttdhr committed Dec 6, 2023
1 parent 9929ca0 commit d61fc9b
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions packages/edit-site/src/components/save-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,33 @@ export default function SaveButton( {
}, [] );

const { setIsSaveViewOpened } = useDispatch( editSiteStore );
const { customizedSaveButtonAction, customizedSaveButtonLabel } = useSelect( ( select ) => {
const { getSettings } = unlock(select( editSiteStore ));
return {
customizedSaveButtonAction: getSettings().__experimentalSaveButtonAction,
customizedSaveButtonLabel: getSettings().__experimentalSaveButtonLabel,
};
}, []);
const { customizedSaveButtonAction, customizedSaveButtonLabel } = useSelect(
( select ) => {
const { getSettings } = unlock( select( editSiteStore ) );
return {
customizedSaveButtonAction:
getSettings().__experimentalSaveButtonAction,
customizedSaveButtonLabel:
getSettings().__experimentalSaveButtonLabel,
};
},
[]
);
const onClick = useCallback( () => {
if ( customizedSaveButtonAction ) {
customizedSaveButtonAction();
return;
}
setIsSaveViewOpened( true );
}, [ customizedSaveButtonAction, setIsSaveViewOpened ]);
}, [ customizedSaveButtonAction, setIsSaveViewOpened ] );

// For testing
const { updateSettings } = useDispatch( editSiteStore );
useEffect( () => {
updateSettings( {
__experimentalSaveButtonAction: () => console.log('Customized Action'),
__experimentalSaveButtonAction: () =>
// eslint-disable-next-line no-console
console.log( 'Customized Action' ),
__experimentalSaveButtonLabel: 'Customized Action',
} );
}, [ updateSettings ] );
Expand Down

0 comments on commit d61fc9b

Please sign in to comment.