client/state/initial-state.js
function verifyStoredRootState( state ) {
	const currentUserId = get( user.get(), 'ID', null );
	const storedUserId = get( state, [ 'currentUser', 'id' ], null );

	if ( currentUserId !== storedUserId ) {
		debug( `current user ID=${ currentUserId } and state user ID=${ storedUserId } don't match` );
		return false;
	}

	return true;
}
function verifyStoredRootState( state ) {
	const currentUserId = get( user.get(), 'ID', null );
	const storedUserId = get( state, [ 'currentUser', 'id' ], null );

	if ( currentUserId !== storedUserId ) {
		debug( `current user ID=${ currentUserId } and state user ID=${ storedUserId } don't match` );
		return false;
	}

	return true;
}
function verifyStoredRootState ( state ) { const currentUserId = get ( user . get ( ) , 'ID' , null ) ; const storedUserId = get ( state , [ 'currentUser' , 'id' ] , null ) ; if ( currentUserId !== storedUserId ) { debug ( ` ${ currentUserId } ${ storedUserId } ` ) ; return false ; } return true ; }
This check is most important to do on save (to prevent bad data from being written to local storage in the first place). But it is worth doing also on load, to prevent using historical bad state data (from before this check was added) or any other scenario where state data may have been stored without this check being performed.
This check is most important to do on save ( to prevent bad data from being written to local storage in the first place ) . But it is worth doing also on load to prevent using historical bad state data ( from before this check was added ) or any other scenario where state data may have been stored without this check being performed .