reactotron icon indicating copy to clipboard operation
reactotron copied to clipboard

Creates new connection on every refresh

Open pekq opened this issue 8 years ago • 10 comments

image

I find the new multiple connection feature a pain to use as on every browser page refresh it creates a new connection. User must then manually switch to the newest connection from Reactotron. I wonder if this is intentional or bug?

Dependencies:

    "reactotron-apisauce": "2.0.0",
    "reactotron-react-js": "2.0.0",
    "reactotron-redux": "2.0.0",
    "reactotron-redux-saga": "2.0.0"

Setup:

import Config from './DebugConfig'
import Reactotron from 'reactotron-react-js'
import Immutable from 'seamless-immutable'
import { reactotronRedux as reduxPlugin } from 'reactotron-redux'
import tronsauce from 'reactotron-apisauce'
import sagaPlugin from 'reactotron-redux-saga'

if (Config.useReactotron) {
  Reactotron
    .configure({ name: '☠☠' })
    .use(reduxPlugin({ onRestore: state => Immutable(state) }))
    .use(sagaPlugin())
    .use(tronsauce())
    .connect()
    .clear()

  console.tron = Reactotron
} else {
  console.tron = {
    log: () => false,
    warn: () => false,
    error: () => false,
    display: () => false,
    image: () => false
  }
}

pekq avatar Aug 01 '18 16:08 pekq

Nope that's a bug.

We'll need to add similar id storage over in reactotron-react-js.

skellock avatar Aug 02 '18 11:08 skellock

I am still having this problem. I reinstalled Reactotron, and updated my npm package.

Any advice?

Ventronik avatar Aug 15 '18 18:08 Ventronik

@Ventronik This was fixed an hour ago so it's not in a release yet.

ruddell avatar Aug 15 '18 19:08 ruddell

I suddenly started to have this issue with 2.17.0 , with React Native.

My setup:

import Reactotron from "reactotron-react-native";
import { reactotronRedux } from "reactotron-redux";

const reactotron = Reactotron.configure({ name: "MyApp" })
  .useReactNative()
  .use(reactotronRedux())
  .connect();

export default reactotron;

EDIT:

found out the reason - in case somebody runs into same issue:

I'm using the reactotron-react-native 4.0.0.beta.1 which introduces setAsyncStorageHandler method. If not provided, the above metioned behaviour will occur. Correct setup should be:

import Reactotron from "reactotron-react-native";
import { reactotronRedux } from "reactotron-redux";
import AsyncStorage from "@react-native-community/async-storage";

const reactotron = Reactotron.configure({ name: "MyApp" })
  .useReactNative()
  .setAsyncStorageHandler(AsyncStorage)
  .use(reactotronRedux())
  .connect();

export default reactotron;

michal-th avatar Aug 19 '19 09:08 michal-th

Thanks! Solve me problem

jeancabral avatar Sep 20 '19 22:09 jeancabral

If you don't want install or you don't use AsyncStorage in your application, you can use AsyncStorage instead.

This works for me.

import Reactotron from 'reactotron-react-native';
import { AsyncStorage } from 'react-native';

if (DEV) {
const tron = Reactotron.configure({ host: '10.0.63.160' })
.useReactNative()
.setAsyncStorageHandler(AsyncStorage)
.connect();

tron.clear();

console.tron = tron;
}

pc-gs avatar Nov 21 '19 14:11 pc-gs

This will only work until you upgrade to react-native 0.60.x or is it 0.61.x? AsyncStorage is gone from react-native in the latest version

rmevans9 avatar Nov 21 '19 14:11 rmevans9

This will only work until you upgrade to react-native 0.60.x or is it 0.61.x? AsyncStorage is gone from react-native in the latest version

I use with react-native version 0.61.1 and works fine.

pc-gs avatar Nov 21 '19 14:11 pc-gs

Ah - I guess they haven't removed it yet. It will be going away at some point:

https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#deprecated-2

rmevans9 avatar Nov 21 '19 14:11 rmevans9

This will only work until you upgrade to react-native 0.60.x or is it 0.61.x? AsyncStorage is gone from react-native in the latest version

I use with react-native version 0.61.1 and works fine.

@pedrocarlos-ti If i want to see any logs in it after i open debug mode it appears on browser, not in reactotron! I can't see any logs just "Connection"

anastely avatar Jan 30 '20 18:01 anastely