Support callbacks in React#10518
Merged
Merged
Conversation
Contributor
|
Web viewer built successfully. If applicable, you should also test it:
Note: This comment is updated whenever you push a commit. |
a45501b to
1f8f148
Compare
Member
Author
|
I thought there was some kind of performance regression in the React package, but I probably just built it in debug mode 😬. Can't repro anymore, so this is ready |
Wumpf
approved these changes
Jul 10, 2025
Member
Wumpf
left a comment
There was a problem hiding this comment.
this prop name to event name transformation could be a bit brittle though, no? Sounds like we should leave a note to keep those names carefully in sync
Otherwise really nice to not have those duplicated once more!
Member
Author
Yes, should add a note about making sure the event names are |
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.
Produces
rerun_js/web-viewer/web-viewer.tar.gzandrerun_js/web-viewer-react/web-viewer-react.tar.gzThese can be installed into e.g. https://github.com/rerun-io/web-viewer-react-example by running:
Afterwards run the example as normal. You can find the new callback props available on the
WebViewercomponent, e.g.onPlay,onTimeUpdate, etc.Implementation details
I felt bad about adding another layer of stuff that anyone working on events has to deal with, so this requires no effort whatsoever to maintain.
The callback prop types are generated automatically from
@rerun-io/web-viewerevent types. When a callback prop is registered, the prop name is transformed to the event name (removeonprefix, snake_case it), which is then directly registered on the underlyingWebViewerinstance. This way we don't need to maintain a list of events on the React side, it stays up to date automatically as new events are added in the non-React package.