Selection type not restored after undo

I’ve noticed if I have a paragraph selected as a NodeSelection, I delete it (or cut it) and then undo, I then have an empty TextSelection, i.e. just the caret blinking at the start of the un-deleted paragraph.

Is that expected? I would like to have the previous selection restored, but maybe I need to do some work to make that happen.

When I try this (press esc in a paragraph on prosemirror.net, del, then undo), I get my node selection back.

Sorry not to try that simple test first! Forgot that was bound to esc by default. So it’s my fault… : )