mui-toolpad icon indicating copy to clipboard operation
mui-toolpad copied to clipboard

Fix fetch query preview

Open bytasv opened this issue 3 years ago • 3 comments

  • Follow up for https://github.com/mui/mui-toolpad/pull/1153#discussion_r996274109

  • Kept only logic which checks if untransformed data is undefined

  • Rendering undefined as a returned value in JsonView

image

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 { }.

image

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: image

And with empty object: image

I kept this part as is, lemme know if you think we should change it as well

bytasv avatar Oct 17 '22 07:10 bytasv

Your Render PR Server URL is https://toolpad-pr-1165.onrender.com.

Follow its progress at https://dashboard.render.com/web/srv-cd6gjuaen0hsgl6sno1g.

render[bot] avatar Oct 17 '22 07:10 render[bot]

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

Janpot avatar Oct 17 '22 14:10 Janpot

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: image

The logic would be that we iterate through globalScope keys and render each using JsonView without nodeRenderer defined?

bytasv avatar Oct 17 '22 15:10 bytasv

image

Added this warning back, but only if transform returns undefined, @Janpot lemme know if I understood your suggestions correctly

bytasv avatar Oct 21 '22 13:10 bytasv