in the docs) unless you've forgone using the manager.
If you need to set the chain, use safeSetManagerChain.
If enabling/disabling Manager.state.isRecording it's suggested you use safeSetManagerChain just before.
This can be an issue because there isn't a way to tell the manager you want to replace multiple properties and it might be impossible to, for example, replace commands with a smaller subset but not have it error even if you're planning to replace the shortcuts so they don't contain missing commands.
To achieve this, you can shallow clone the manager, change all the properties you want directly, then validate it's state by using isValidManager which is what this function does internally.
Once you know it's valid, detach the old manager and attach the new one.
const clone = {...manager, keys: newKeys, shortcuts: newShortcuts}
if (isValidManager(manager)) {
detach(manager, ...)
attach(clone, ...)
}
Safely sets a settable manager property.
You should not use this to set properties the manager manages (those tagged with