Closed oliviertassinari closed 2 years ago
Just gonna put a more radical idea out there, but what if instead of trying to create a UI that would support every possible use case that people may have, we just give people a code editor and let them write the request together with any possible post-processing themselves?
e.g. you'd just write
export default async () => fetch('/my/api');
and it would run this, serverside, with the baseUrl and headers of the connection automatically supplied. This would give you full freedom to add any pre or post-processing you desire. It'd essentially be a serverless function we allow users to write.
this would also be beneficial implementing the bundle size monitor as that requires chaining two Rest calls. It could be done in a single serverside function.
Adding a proposal for that here: https://github.com/mui/mui-toolpad/issues/628
For an invalid request URL (done through functions data source). I get the following response in Postman:
And this one in Toolpad:
How can we improve response messages?
There is a network panel now to debug the request that has all this information. Its UX could be improved, tracking that in in https://github.com/mui/mui-toolpad/issues/739.
I have faced a frustration about this when I worked with Pipedream yesterday. I was calling the Google Calendar API with a wrong end date, but the error message was obscure. It took me a while to figure it out. It was after I made this fix https://github.com/PipedreamHQ/pipedream/pull/4063. I almost gave up. So 👍 to stay attentive to recovery experience on mistakes.
I will double check, but I suspect that based on Jan comment we can close this issue, you will never get completely stuck with the new network panel 😍
From my end, we can close, the pain I raised is solved thanks to:
The only feedback I would leave is the timeline view is a distraction. I think that listing the previous API calls is enough, it would be better to hide the timeline.
Ok, I'll close this issue as the Network tab gives all of the needed info.
Duplicates
Latest version
Summary 💡
When an API request is not OK
https://github.com/mui/mui-toolpad/blob/479def38e5a01f23aac7da8bb90f33f78e49fe9d/packages/toolpad-app/src/toolpadDataSources/rest/server.ts#L60
It only logs the error:
However, it's not helpful. I would expect something like this (Postman):
https://mui-org.postman.co/workspace/Team-Workspace~a3fd1430-e7a2-482a-8fa2-e4f40a2223c8/request/19543436-85f9898b-a606-4caa-ad96-cb46ba1257ea
or
Examples 🌈
To reproduce
For context, it calls https://app.goflightlabs.com/flights
Motivation 🔦
I had to run the project locally to add a console.log to understand what was going wrong. Ideas for follow-ups: