feat(eventing): emit lifecycle events for update, delete, reply CRUD#761
Draft
jackiejou wants to merge 3 commits into
Draft
feat(eventing): emit lifecycle events for update, delete, reply CRUD#761jackiejou wants to merge 3 commits into
jackiejou wants to merge 3 commits into
Conversation
Threads in PopupV2 can now edit and delete replies. Reply edits dispatch
to PUT /undoc/comments/{id} and reply deletes to DELETE
/undoc/comments/{id} via the box-ui-elements ThreadedComments client.
- Adds updateReplyAction and deleteReplyAction thunks. Both reject
upfront when the reply is not present in state so callers receive a
typed error instead of an opaque server response.
- Adds reducer cases that replace or remove the targeted reply on
fulfilled.
- Threads the canEdit permission through replyToTextMessage so the
edit affordance reflects backend permissions.
- Widens the Token type with TokenMap so consumers can pass a per-typed
file id resolver for avatar fetching.
replyToTextMessage was not setting updatedAt on the message, so the edit indicator never appeared on edited replies even though the backend returns modified_at on the comment object. The Reply type also did not declare the field.
box-annotations only emitted lifecycle events for the create flow.
Other thunks ran their API calls and updated internal state, but
withAnnotations listeners on the box-ui-elements side never fired,
so the activity feed went stale until reload.
Adds outbound eventing for five thunks following the existing
create.ts pattern:
- updateAnnotationAction emits annotations_update (covers resolve
and unresolve via annotation.status)
- deleteAnnotationAction emits annotations_delete
- createReplyAction emits annotations_reply_create
- updateReplyAction emits annotations_reply_update
- deleteReplyAction emits annotations_reply_delete
Each handler emits via the singleton eventManager with the
{ annotation, error, meta: { requestId, status } } envelope. Reply
handlers add an annotationReply field carrying the reply object.
Generalizes AsyncAction over arg/payload so each handler can type
its action precisely. Each success-phase handler short-circuits
when the necessary payload is missing instead of emitting a
contradictory success event.
7881a6f to
ed32599
Compare
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create.tspattern:updateAnnotationActionemitsannotations_update(also covers resolve/unresolve viaannotation.status)deleteAnnotationActionemitsannotations_deletecreateReplyActionemitsannotations_reply_createupdateReplyActionemitsannotations_reply_updatedeleteReplyActionemitsannotations_reply_deleteeventManagerwith{ annotation, error, meta: { requestId, status } }. Reply handlers add anannotationReplyfield carrying the reply object.AsyncAction<TArg, TPayload>so each handler can type its action precisely.Test plan
yarn jest --testPathPattern="store/eventing"passes (61 tests across 14 suites).