tinybase icon indicating copy to clipboard operation
tinybase copied to clipboard

StoreInspector requires ui-react/debug

Open marbemac opened this issue 2 years ago • 3 comments

Describe the bug

Getting the There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component. message in the StoreInspector.

Pretty sure it's a context mismatch issue. Adjusting my ui-react import to use the debug build (e.g. import * as UiReact from 'tinybase/debug/ui-react/with-schemas'; fixes the issue (but obviously don't want to ship with this).

Looking at the build output of ui-react-dom (lib/debug/ui-react-dom.js), it's importing what it needs from ui-react from ./ui-react (the debug version), so the react context isn't matching up if end user is using non debug ui-react.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Follow the documentation on setting up the StoreProvider (I'm using imports, not script tags w UMD build, in case that matters).
  2. See issue

Expected behavior

No response

Screenshots or Videos

No response

Platform

No response

Additional context

No response

marbemac avatar Oct 28 '23 19:10 marbemac

Yes... I've hit this in the past too. You currently need both the ui-react and ui-react-dom libraries to be the debug version (on the assumption they will be compiled away for prod). I'm not 100% this can be mitigated, but I will have a go.

jamesgpearce avatar Oct 29 '23 12:10 jamesgpearce

What is the difference between the debug versions and the regular versions? When using something like Vite to bundle everything up for prod, is there any downside to using the debug versions vs the non debug?

If no downside, then maybe it's just a matter of updating the StoreInspector docs to point out one must use the debug version of ui-react - right now the example shows using the regular ui-react:

Screenshot 2023-10-29 at 4 41 44 PM

marbemac avatar Oct 29 '23 21:10 marbemac

Apart from the presence of the inspector it's just that the debug version is not minified. If I can't fix it to be more intuitive, I will do a better job of documenting it, for sure.

jamesgpearce avatar Oct 29 '23 22:10 jamesgpearce

Check out the new v5.0.0-beta.21 release: in it, the StoreInspector (now called Inspector) is in its own module that can run in either debug or non-debug mode.

Hoping we can close this out, but please check and re-open if not!

https://beta.tinybase.org/guides/releases/#the-tinybase-inspector

jamesgpearce avatar Jun 12 '24 05:06 jamesgpearce