phoenixframework / phoenix_live_view

Rich, real-time user experiences with server-rendered HTML
https://hex.pm/packages/phoenix_live_view
MIT License
5.99k stars 902 forks source link

Track distinct loading and lock refs #3324

Closed chrismccord closed 1 week ago

chrismccord commented 1 week ago

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.

chrismccord commented 1 week ago

❤️❤️❤️🐥🔥