The idea is that, during phx-change, a form will be locked, because
we don't want to show intermediate validation results as the user is
typing. However, on phx-submit, we don't want to lock it, because
we may receive upload related updates. So we have two references,
one for tracking locking and another for tracking loading states.
Also, when undoing references, we need to undo the lock ones
recursively. That's because locking works by cloning the dom and
applying updates to the dom. But the cloned dom itself may have
locked references that are now outdated, so we undo them
recursively.
The idea is that, during phx-change, a form will be locked, because we don't want to show intermediate validation results as the user is typing. However, on phx-submit, we don't want to lock it, because we may receive upload related updates. So we have two references, one for tracking locking and another for tracking loading states.
Also, when undoing references, we need to undo the lock ones recursively. That's because locking works by cloning the dom and applying updates to the dom. But the cloned dom itself may have locked references that are now outdated, so we undo them recursively.