Dispatching TransactionSpec or Transaction

I notice, looking at uses of view.dispatch in the CodeMirror repositories, that view.dispatch is usually called with one or more TransactionSpec, but sometimes with one or more Transaction (particularly in @codemirror/commands), and occasionally a mix of both.

Is there a particular situation where it’s better to use view.state.update(transactionSpec) and then call view.dispatch with Transaction, rather than dispatching the TransactionSpec directly?

No. The dispatch function will call state.update for you. But sometimes you need the Transaction object before dispatching it, so doing it yourself is valid too.

Thanks, that makes sense. I guess I’m still wondering about cases where having the Transaction object would be useful before dispatching it - are there any examples currently in use?

It seems like all the uses in @codemirror/commands could dispatch a TransactionSpec instead of a Transaction, unless there’s some reason to use a Transaction to indicate that it shouldn’t be merged with other transactions/specs?