remote-redux-devtools icon indicating copy to clipboard operation
remote-redux-devtools copied to clipboard

Logging server-side actions

Open oyeanuj opened this issue 7 years ago • 6 comments

Hi @zalmoxisus! I am building a universal app that needs to support SSR. I wasn't sure from the documentation if this library would be appropriate for that?

Ideally, I am looking to get the actions logged on the terminal on the server to show up on the extension. So far in setting it up, it seems that the actions that execute on the server still get logged there and subsequent actions get logged on the extension.

Is that a problem with my setup?

Here is what my code looks like right now:


const composeEnhancers = composeWithDevTools({ realtime: true, port: 8000 });
//const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

store = createStore(
  reducer,
  initialState,
  composeEnhancers(
    applyMiddleware(...middleware),
    persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
  )
);

Thank for you all your work on all the extension tools!

oyeanuj avatar Nov 08 '16 05:11 oyeanuj

Yes, the configuration is ok. Just make sure to open Remote DevTools in the extension:

redux_devtools

Strange that persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) doesn't through on server side.

zalmoxisus avatar Nov 08 '16 09:11 zalmoxisus

Hm.. I removed persistState to see if that helped, but still no luck. It seems that the actions that execute on the server still get logged there and subsequent actions (which occur on the client side) get logged on the extension.

FWIW, the remotedev looks like this -

→ npm run remotedev

> [email protected] remotedev /Users/anuj/Github/shuffle-web
> remotedev --hostname=localhost --port=8000

[RemoteDev] Start server...
--------------------------------------------------------------------------------

   [Busy] Launching SocketCluster
   [Active] SocketCluster started
            Version: 5.0.18
            WebSocket engine: uws
            Port: 8000
            Master PID: 62891
            Worker count: 1
            Broker count: 1

Is there a particular piece that I start by debugging? Any guesses on what might be going on?

oyeanuj avatar Nov 08 '16 23:11 oyeanuj

Is there a particular piece that I start by debugging? Any guesses on what might be going on?

You can start with our simple node example to see how it works. Add your port here. Also note that the example uses an old version of remote-redux-devtools. If you update it, and still use CommonJS, make sure to add .default here.

zalmoxisus avatar Nov 09 '16 09:11 zalmoxisus

You can start with our simple node example to see how it works.

@zalmoxisus that example works just as fine. Is it possible that SSR doesn't work in my case since the request is client-initiated? Or do you suspect some other problem?

oyeanuj avatar Nov 09 '16 22:11 oyeanuj

@oyeanuj, if you could provide an example repo, I'd look into it. Maybe you just didn't set the port on Remote Devtools windows's settings? You could try without adding port parameter so it will communicate via our remote server (as in the example).

zalmoxisus avatar Nov 10 '16 10:11 zalmoxisus

Maybe you just didn't set the port on Remote Devtools windows's settings? You could try without adding port parameter so it will communicate via our remote server (as in the example).

Tried both methods but same result :(

It is a little hard to replicate the repo I am working on, but I will try to provide some example repo where this can be reproduced.

(If not, maybe a screenshare or something could also work if you have the bandwidth? No worries if that is asking for too much time!)

oyeanuj avatar Nov 10 '16 20:11 oyeanuj