Skip to content

Commit

Permalink
removing not needed changes to save hub button
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto committed Sep 14, 2023
1 parent 1e43b4a commit 93eb81a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/edit-site/src/components/save-hub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ const PUBLISH_ON_SAVE_ENTITIES = [
];

export default function SaveHub() {
const saveNoticeId = 'site-edit-save-notice';
const { params } = useLocation();

const { __unstableMarkLastChangeAsPersistent } =
useDispatch( blockEditorStore );

const { createSuccessNotice, createErrorNotice } =
const { createSuccessNotice, createErrorNotice, removeNotice } =
useDispatch( noticesStore );

const { dirtyCurrentEntity, countUnsavedChanges, isDirty, isSaving } =
Expand Down Expand Up @@ -107,6 +108,7 @@ export default function SaveHub() {
const saveCurrentEntity = async () => {
if ( ! dirtyCurrentEntity ) return;

removeNotice( saveNoticeId );
const { kind, name, key, property } = dirtyCurrentEntity;

try {
Expand All @@ -132,6 +134,7 @@ export default function SaveHub() {

createSuccessNotice( __( 'Site updated.' ), {
type: 'snackbar',
id: saveNoticeId,
} );
} catch ( error ) {
createErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` );
Expand All @@ -148,6 +151,7 @@ export default function SaveHub() {
disabled={ isSaving }
aria-disabled={ isSaving }
className="edit-site-save-hub__button"
__next40pxDefaultSize
>
{ label }
</Button>
Expand All @@ -157,7 +161,8 @@ export default function SaveHub() {
variant={ disabled ? null : 'primary' }
showTooltip={ false }
icon={ disabled && ! isSaving ? check : null }
textForDefaultState={ label }
defaultLabel={ label }
__next40pxDefaultSize
/>
) }
</HStack>
Expand Down

0 comments on commit 93eb81a

Please sign in to comment.