Skip to content

Conversation

mschristensen
Copy link
Contributor

@mschristensen mschristensen commented May 28, 2025

Description

Adds an example app for the new message annotations feature. Showcases:

  • Publishing annotations to a message for each of the different annotation types
  • Subscribing to annotation summaries for each message
  • Subscribing to raw message annotations
  • Deleting message annotations

I recorded a quick Loom to walk through this example: https://www.loom.com/share/e8e37e37d7c04999b82493142b445336?sid=25392ef5-5d8e-4225-8bea-1e2f08fb31f4

I intend to update the docs before landing this PR, but opening now for draft review.

This examples requires us to configure a namespace (channel rule) with the mutableMessages flag enabled. We need to identify how we can do this when used from the examples.

This also needs an image to include on the examples index.

Checklist

Copy link

coderabbitai bot commented May 28, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/PUB-1765-annotations-examples

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@SimonWoolf SimonWoolf self-requested a review July 1, 2025 13:33
@GregHolmes GregHolmes force-pushed the feature/PUB-1765-annotations-examples branch 2 times, most recently from 7f3370d to f7a321a Compare October 1, 2025 16:56
export const channelName = urlParams.get('name') || 'mutable:pub-sub-message-annotations';
export const annotationNamespace = 'my-annotations';
export const annotationNamespace = 'annotation';
export const channelName = urlParams.get('name') || `${annotationNamespace}:pub-sub-message-annotations`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GregHolmes your commit message doesn't explain why you made this change, but I strongly disagree with it: I think using the same "annotationNamespace" config variable for two unrelated purposes (the first part of the channel name, and the user-settable part of the annotation type) is very confusing for the user, who might be misled into thinking those have to match.

@SimonWoolf SimonWoolf force-pushed the feature/PUB-1765-annotations-examples branch from f7a321a to 1e59237 Compare October 7, 2025 15:48
@SimonWoolf
Copy link
Member

SimonWoolf commented Oct 7, 2025

Added two commits:

  • cb7e97e -- stop using type assertions for custom MessageSummary and CreateMessage types, and switch to more natural way of verifying that there's a serial
  • d81077d -- stop using annotationNamespace to control both the channel namespace and the user-settable part of the annotation type, add a section to the readme about setting up a channel rule, and refactor to make the annotation namespace not an app-wide config var, which I think will help avoid confusion between the two

@SimonWoolf SimonWoolf force-pushed the feature/PUB-1765-annotations-examples branch from 1e59237 to d81077d Compare October 7, 2025 15:51
@m-hulbert m-hulbert added the review-app Create a Heroku review app label Oct 14, 2025
@ably-ci ably-ci temporarily deployed to ably-docs-feature-pub-1-9hp6ha October 14, 2025 14:07 Inactive
@m-hulbert m-hulbert temporarily deployed to ably-docs-feature-pub-1-9hp6ha October 14, 2025 14:32 Inactive
@m-hulbert m-hulbert force-pushed the feature/PUB-1765-annotations-examples branch from aa69133 to 8a26e17 Compare October 14, 2025 14:33
@m-hulbert m-hulbert marked this pull request as ready for review October 14, 2025 14:33
Copy link
Contributor

@m-hulbert m-hulbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some minor fixes to the copy and list numbering.

Tested and all LGTM.

Uses a double-pane view to show the example side by side for two
different clients.
Shown in an expandable pane when the message is clicked.
Publish an annotation, specifying the annotation type.

Summaries are received as a message in the subscribe listener.
Listens for annotation summaries received in realtime and renders their
information for each summary type in a set of expandable summary
components in the message details.
Separates the annotations summary from the raw annotations messages
displayed in separate tabs.
Adds a delete button to raw annotations to publish a delete annotation
which removes the annotation from the summary.

Refactors the raw annotation view to display in a more compact format.
mschristensen and others added 11 commits October 14, 2025 16:54
Various improvements to the components and styling to create a more
compact visual style.
Adds the franken-ui dependency to the examples renderer.

Updates the set of visible files configured for sandpack.
- stop using type assertions for custom MessageSummary and CreateMessage
types
- switch to more natural way of checking that there's a serial
Add a section to the readme about setting up a channel rule

Refactor to make the annotation namespace not an app-wide config var
(which is somewhat misleading -- there's no reason it should be the same
throughout an app, and indeed making it so defeats the point of having
it)
@rainbowFi rainbowFi force-pushed the feature/PUB-1765-annotations-examples branch from 8a26e17 to f0097ff Compare October 14, 2025 15:55
@ably-ci ably-ci temporarily deployed to ably-docs-feature-pub-1-9hp6ha October 14, 2025 15:55 Inactive
@rainbowFi rainbowFi enabled auto-merge (squash) October 14, 2025 16:00
@rainbowFi rainbowFi merged commit a5e311b into main Oct 14, 2025
6 checks passed
@rainbowFi rainbowFi deleted the feature/PUB-1765-annotations-examples branch October 14, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

6 participants