ui: refactor code for determining if an update should be sent to the client