mui / toolpad

Toolpad: Full stack components and low-code builder for dashboards and internal apps.
https://mui.com/toolpad/
MIT License
1.27k stars 282 forks source link

"Resources" folder is not created on startup sometimes #1914

Closed prakhargupta1 closed 1 year ago

prakhargupta1 commented 1 year ago

Duplicates

Latest version

Steps to reproduce 🕹

Steps:

  1. Started a fresh project using yarn create toolpad app (later also tried using npx)
  2. Somehow, it doesn't come with resources or components folder
  3. After yarn dev, when I click on server side javascript query, I get the below error and the app stops

Current behavior 😯

Screenshot 2023-04-20 at 1 11 35 PM

Expected behavior 🤔

No response

Context 🔦

No response

Your environment 🌎

Mac Toolpad version v0.1.6

Janpot commented 1 year ago

I can't reproduce

Started a fresh project using yarn create toolpad app (later also tried using npx)

Can you share the exact commands and input that you've used to get to this project?

From your screenshot it looks like you have a pg_admin folder inside of a pg_admin folder. Are you sure you're starting toolpad in the right folder?

apedroferreira commented 1 year ago

Just tried and I can't reproduce it either.

prakhargupta1 commented 1 year ago

Started a new folder and tried again. Not sure what got missed.

https://user-images.githubusercontent.com/92228082/233332691-ee83b5c0-dd2d-48fd-9fba-90cb3cf01a88.mov

apedroferreira commented 1 year ago

This is exactly the error we had on Windows... But the create-toolpad-app version you were using yesterday shouldn't have included those fixes yet, right? If it did then it's something with the Windows fix for the path.

Edit: nevermind I see it's not creating a resources folder like it should, different issue then

apedroferreira commented 1 year ago

Ok I also got this after all but nothing crashed:

Screenshot 2023-04-21 at 12 33 26

I think it's a temporary error when we create a new toolpad app with create-toolpad-app and run yarn dev and we go to create a custom function. It works but because it didn't create the resources folder right away it shows this error in the console when it tries to get the list of available functions.

So we should probably fix this just not to show the ugly console error at least.

prakhargupta1 commented 1 year ago

But since there is no resources folder. I can't write a code query. I'll upgrade to v0.1.7 and retry.

apedroferreira commented 1 year ago

But since there is no resources folder. I can't write a code query. I'll upgrade to v0.1.7 and retry.

It ended up creating the resources folder for me when I pressed Open editor, but it wasn't there in the beginning. I think the fixes in v0.1.7 are unrelated so the issue should still be there.

prakhargupta1 commented 1 year ago

Upgraded to v0.1.7 and this issue is gone!

prakhargupta1 commented 1 year ago

This again happened today when I created a fresh app using yarn create toolpad-app. Somehow resources folder isn't created sometimes.

Screenshot 2023-05-02 at 2 16 33 PM
prakhargupta1 commented 1 year ago

This is still happening in v0.1.11. Components folder is also not being created.

Janpot commented 1 year ago

So far that has been deliberate. The idea was that the project folders comes as thin as possible and these folders get created on demand as the first function is added or the first component is added. Do you think we should always create these folders/files when the project starts up, even when users don't need them?

prakhargupta1 commented 1 year ago

Ok, just validated this. After learning how Toolpad works, there would be times when a user would start from a function or code component, so creating them by default sounds reasonable to me. Having these folders not created makes me question if there was some issue in the installation process.

prakhargupta1 commented 1 year ago

On my machine when I create a fresh toolpad app, the following issues are observed:

  1. Custom component creation works fine. A folder gets created, but the Open button doesn't work. It says No code editor found. Also reported here
  2. When creating a custom function, I see no function to pick from and no resources folder. Not sure what is the trigger for folder creation in this case. Open Editor is the trigger for resources folder creation. Being tackled here #2063 I am closing this issue as both concerns are being dealt with in other issues.

https://github.com/mui/mui-toolpad/assets/92228082/74f6fac4-2205-46ea-880f-15af3be33967