Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spy, tool, Debugging stores #181

Open
jonlepage opened this issue May 15, 2020 · 4 comments
Open

Spy, tool, Debugging stores #181

jonlepage opened this issue May 15, 2020 · 4 comments

Comments

@jonlepage
Copy link

Hi friend, did RES have a way to get all stores debug in developperTools ?
Any specific plugins or did you have natively something to spy All stores when a app run ?
image

How you guys perform debugging with this library ?
Only with console.log ?

@solkimicreb
Copy link
Member

Hi! We don't have any official debug tools yet. It's on the roadmap but not for the next release, unfortunately. For now, the best way to debug is:

  • console.log
  • exposing the buggy store on the window (window.debugStore = myStore) and mutating/logging it from the browsers developer console to trigger/see state changes and how the views update

@ciaoben
Copy link

ciaoben commented May 18, 2020

@solkimicreb is there a way to attach console.log to the proxies of the store to log every single mutation it happens?
I remember to have used something similar in some old version but can't find it now

@solkimicreb
Copy link
Member

@ciaoben Not in the current version (it was an undocumented thing so we removed it without any announcement). It is coming back in the next version in a more generic and powerful way though.

The API will be something like

const myStore = store({}, {
  proxyHandlers: {
    get: () => {},
    ....
  },
})

You will be able to intercept/overwrite any operation in a store with the proxyHandlers. It is intended to be a low level API for further changes but it will be public and available for anyone to use.

@jonlepage
Copy link
Author

thank you for this clarification.
Otherwise on my side I improvise an alternative with nwjs and electron.
https://nwjs.io/
For who dev desktop app, i just open a new context window and share a global stores with ref of all child's stores.
Similar to this demo.
#182

Work but not perfect! You can add a onChange to make FX when a store change.
It limited design but work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants