feat(runtime,jest,bridge): add console forwarding and batched state updates#61
Closed
bheemreddy-samsara wants to merge 1 commit intocallstackincubator:mainfrom
Conversation
|
@bheemreddy-samsara is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
5f9bae7 to
ae5e7b8
Compare
…pdates Console Forwarding: - Forward console.log/warn/error/info/debug from device to Jest output - Add ConsoleEvent/ConsoleLevel types to BridgeEvents union - Preserve Error details (stack/message) in forwarded output - Fix %d printf placeholder to use Number() for decimals Type Improvements: - Remove type assertions in factory.ts with proper ConsoleEvent types - Add proper generic constraints for Harness.on/off methods - Import shared ConsoleEvent type in jest package Shared Utilities: - Extract batchedUpdate utility to avoid code duplication - Add resetRenderState helper for common state reset pattern - Simplify render/cleanup.ts using shared utilities
ae5e7b8 to
55a1412
Compare
V3RON
reviewed
Jan 22, 2026
Comment on lines
+4
to
+5
| * Batches state updates to avoid act() warnings in React Native. | ||
| * Falls back to direct execution if unstable_batchedUpdates is unavailable. |
Contributor
There was a problem hiding this comment.
You should not see 'act' warnings as this is a normal React Native app. Could you provide a code sample where it happens?
Contributor
There was a problem hiding this comment.
I suspect this is only happening on the old arch and not on the new arch since it has autobatching enabled. We'll try to provide a minimal repro soon.
V3RON
reviewed
Jan 22, 2026
Contributor
V3RON
left a comment
There was a problem hiding this comment.
If you enable 'server.forwardClientLogs' via @react-native-harness/metro, you should see client_log events being reported by the Metro reporter in @react-native-harness/bundler-metro.
Contributor
Contributor
Author
|
closing in favor of #63 |
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
unstable_batchedUpdatesto prevent React act() warnings during testingWhat changed
Bridge package (
packages/bridge/)ConsoleEventandConsoleLeveltypesConsoleEventtoBridgeEventsunionJest package (
packages/jest/)on/offmethods usingBridgeServerEventsstringtype in favor of typed event namesConsoleEventfrom bridge package instead of local definition%s,%d,%i,%o,%O,%j)%dto useNumber()(preserves decimals) vs%iusesparseInt()(integers only)Runtime package (
packages/runtime/)unstable_batchedUpdatesresetRenderState()helper for common state reset patternresetRenderState()helperbatchedUpdateandresetRenderStateutilitiesConsoleEventis inBridgeEventsErrordetails (stack/message) instead of serializing to{}Test plan
console.error(new Error('test'))