question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[devtools] doesn't log actions since v2

See original GitHub issue

When updating from 1.0.7 to 2.2.1, I lose the tracking of all actions in the Redux devtools:

2.2.1

image

1.0.7

image

The app works just fine and the store updates correctly when using the app, it just doesn’t log out the commits any more.

Using it like:

import create, { StateCreator } from 'zustand'
import { devtools } from 'zustand/middleware'

export const DefaultStoreState: DefaultStateGetters = {
  lastDataUpdate: new Date(),
  loading: false,
  showDrawer: false,
  message: null,
  ...
}

const store: StateCreator<DefaultState> = (set, get) => ({
  ...DefaultStoreState,
  ...
})

export const [useStore, Store] = create<DefaultState>(devtools(store, 'WACHS App Store'))

Any pointers would be appreciated. Let me know if you need more detail and I will update this post.

Cheers & thanks Patrik

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

8reactions
ghostcommented, Nov 8, 2019

Hey @pzi,

As you can see on the line https://github.com/react-spring/zustand/blob/master/src/middleware.ts#L33, you need to put name of your function that you want to track in Redux dev tools.

For example:

const [useStore] = create(devtools(set => ({
  count: 1,
  inc: () => set(state => ({ count: state.count + 1 }), 'inc'),
  dec: () => set(state => ({ count: state.count - 1 }), 'dec')
})))

I had the same problem too! Hope this help.

4reactions
aaronmfranciscommented, Nov 14, 2019

For anyone who comes here looking for a quick fix, my solution was to make a type based on the normal StateCreator:

import { State, SetState, StateCreator } from 'zustand';

/** To allow named functions when using devtools */
type StateCreatorDev<T extends State> = (
  set: (partial: Parameters<SetState<T>>[0], name?: string) => void,
  get: Parameters<StateCreator<T>>[1],
  api: Parameters<StateCreator<T>>[2]
) => T;

(edited to work properly, my test wasn’t correct)

Read more comments on GitHub >

github_iconTop Results From Across the Web

[devtools] doesn't log actions since v2 · Issue #77
When updating from 1.0.7 to 2.2.1, I lose the tracking of all actions in the Redux devtools: 2.2.1 1.0.7 The app works just...
Read more >
Chrome dev tools fails to show response even the content ...
I think this only happens when you have 'Preserve log' checked and you are trying to view the response data of a previous...
Read more >
Log messages in the Console - Chrome Developers
DevTools opens the Sources panel after you click log.js:2. The message was logged when the page's JavaScript called console.log('Hello, ...
Read more >
How to generate a F12 Developer Tools log file - Includes Video
1. Login to Smart IT and open the Ticket Console using Chrome. · 2. Select F12 from your keyboard - This will open...
Read more >
Dev Tools Tip - Preserving network logs on leaving a page
If you use the console than you are in luck. Both Chrome and Firefox have options to preserve the console on navigation. In...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found