Skip to content

Commit

Permalink
Remove unnecessary callback - use state function to set current revision
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Jun 12, 2024
1 parent bf55b37 commit 97d34b2
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,6 @@ function ScreenRevisions() {
onCloseRevisions();
};

const selectRevision = ( revision ) => {
setCurrentlySelectedRevision( {
/*
* The default must be an empty object so that
* `mergeBaseAndUserConfigs()` can merge them correctly.
*/
styles: revision?.styles || {},
settings: revision?.settings || {},
_links: revision?._links || {},
id: revision?.id,
} );
};

useEffect( () => {
if (
! editorCanvasContainerView ||
Expand Down Expand Up @@ -178,7 +165,7 @@ function ScreenRevisions() {
/>
) ) }
<RevisionsButtons
onChange={ selectRevision }
onChange={ setCurrentlySelectedRevision }
selectedRevisionId={ currentlySelectedRevisionId }
userRevisions={ currentRevisions }
canApplyRevision={ isLoadButtonEnabled }
Expand Down

0 comments on commit 97d34b2

Please sign in to comment.