mui-toolpad
mui-toolpad copied to clipboard
Fix fetch query preview
-
Follow up for https://github.com/mui/mui-toolpad/pull/1153#discussion_r996274109
-
Kept only logic which checks if untransformed data is undefined
-
Rendering
undefinedas a returned value inJsonView
One thing I'm not sure if it's fine - when api returns empty object, preview just show Object which to me seems a bit confusing (I'd expect maybe to see Object { }.
It seems that this is effect of using custom nodeRenderer, if I removed nodeRenderer, I get result close to what I expect to see in console:

And with empty object:

I kept this part as is, lemme know if you think we should change it as well
Your Render PR Server URL is https://toolpad-pr-1165.onrender.com.
Follow its progress at https://dashboard.render.com/web/srv-cd6gjuaen0hsgl6sno1g.
It seems that this is effect of using custom nodeRenderer, if I removed nodeRenderer, I get result close to what I expect to see in console:
I believe this was originally done to improve how that global scope explorer looks (It was the first thing we used this JsonView for I think). When just used as an output it doesn't work well.
I think if we redesign a little bit how the global scope explorer works, we can remove this nodeRenderer. By redesign I mean: instead of just showing a json view for the whole object, we render each global variable with a JsonView on its own. But we can do that in follow-up.
Just added one comment about what to show in the preview, other than that, I think this lgtm
I think if we redesign a little bit how the global scope explorer works, we can remove this nodeRenderer. By redesign I mean: instead of just showing a json view for the whole object, we render each global variable with a JsonView on its own. But we can do that in follow-up.
Are you talking about this part:

The logic would be that we iterate through globalScope keys and render each using JsonView without nodeRenderer defined?
Added this warning back, but only if transform returns undefined, @Janpot lemme know if I understood your suggestions correctly