react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Objects cannot be copied from console debugger or logged into console using JSON.stringify()

Open krisidmisso opened this issue 1 year ago • 5 comments

Description

Objects cannot be copied inside the console debugger (Chrome inspect/DevTools). Even console.log(JSON.stringify(object)) doesnt log the correct string. Both methods copy or log just the first character{ or [

Tried also upgrading RN but the issue is the same as it was for some other versions previously. May be related to https://github.com/facebook/hermes/issues/761

Steps to reproduce

  1. New RN project
  2. Start metro with --experimental-debugger (react-native start --experimental-debugger)
  3. Run i or a (doesnt matter)
  4. After app is opened, press j in the metro terminal to open the debugger or go to chrome://inspect#devices like in the docs
  5. console.log an object. Ie: console.log({a:1, b:'string', c: 'test'})
  6. Try to copy the logged object from the debugger console. Paste it in any text editor or input and see the issue

React Native Version

0.73.1

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.3
  CPU: (8) arm64 Apple M1 Pro
  Memory: 124.22 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: ~/.nvm/versions/node/v18.19.0/bin/node
  Yarn:
    version: 1.22.21
    path: ~/.nvm/versions/node/v18.19.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v18.19.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.13.0
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.2 AI-212.5712.43.2112.8609683
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.7.8
    path: /opt/homebrew/opt/[email protected]/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

info React Native v0.73.5 is now available (your project is running on v0.73.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.73.5
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.73.5
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".



### Stacktrace or Logs

```text
No error logs, just the described limitation above

Reproducer

https://github.com/krisidmisso/rn-debugger-issue

Screenshots and Videos

No response

krisidmisso avatar Mar 01 '24 00:03 krisidmisso

:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.73.5. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

github-actions[bot] avatar Mar 01 '24 00:03 github-actions[bot]

upgrading to the latest stable version doesnt fix the issue, yet

krisidmisso avatar Mar 28 '24 16:03 krisidmisso

I am using react-native version 0.73.6 This issue is still there.

aurangs7 avatar Apr 03 '24 17:04 aurangs7

related to https://github.com/facebook/react-native/issues/43838

cortinico avatar Apr 04 '24 08:04 cortinico

@krisidmisso Thanks for raising this. We've confirmed this was a regression 0.73 and will be pursuing a fix.

huntie avatar Apr 22 '24 11:04 huntie