feat: Implement optimistic-send UI for chat messages + misc fixes
Become a 10x Instagrammer and Escape Brainrot with Instagram CLI
Brought to you by:
jetc
Originally created by: HaysonC
MessageInfo (id tmp:<uuid>, pending=True) appended under refresh_lock.All mutations to chat_window.messages are protected by refresh_lock and the lock is never held during blocking network I/O.
Data / rendering
pending and failed flags to MessageInfo.Render pending/failed markers in ChatWindow (e.g. " (sending...)", " (FAILED)").
Code style / safety
Use UUID-based temporary IDs to avoid collisions.
Utilities / API changes
utils.py (moved logic out of class methods).Update docstrings to document the renamed parameter (self → client) for the converted functions.
CLI
-h flag as an alias for --help.pending/failed to MessageInfo.refresh_lock).-h flag alias for --help.
Originally posted by: HaysonC
will test more tmr and make sure linting and coding convention follow. i will go to sleep now
Originally posted by: supreme-gg-gg
When running seems like the message disappears for a few seconds after the placeholder and before being updated when the server responds, might have to do with fetching stale messages from backend and refreshing those?
EDIT: shoudl be fixed by the latest commit since we now also manage a local list of pending messages and merge them with stale server messages and expire them when failed / done
Originally posted by: HaysonC
linter passed for me, see if the GitHub workflow ones had any errors
Originally posted by: supreme-gg-gg
Sorry I meant formatter, we don't have a precommit hook for ruff yet because it conflicts with prettier one, so you need to do it manually or format on save unfortunately 😭
Originally posted by: HaysonC
ok, mb, did ruff format .
Ticket changed by: supreme-gg-gg