if i do this , the size seems not apply
const direction = restoreInfo.restoreDirection ?? 'right';
panelSource.size = restoreInfo.panelSizeInParent;
dockLayout.dockMove( panelSource, siblingPanel, direction );
After debug, it seems because you don't check the assignement !?
You should maybe do a Nullish_coalescing_assignment
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_assignment
As you can see here, if i have a panel with size 1, it will be replaced with size of the other panel !

the fix should be :
newPanel.size ??= panel.size;