reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
20.52k stars 1.18k forks source link

Compile time check to see if Wrapping React Package is Valid #3207

Open Alek99 opened 7 months ago

Alek99 commented 7 months ago

Right now in the wrapping react API a user can provide an invalid package name and get a run time error in the terminal for bun/npm about trying to download a package that doesn't exist

I think we can check this at compile time to see if the wrapping react package/version is valid by running the library through this API https://api.npms.io/v2/package/{packageName} where {packageName} is the name of the npm package you want to check. And then provide a more concise error message that can better help the user.

See the example here with chakra https://api.npms.io/v2/package/chakra-ui

TG199 commented 6 months ago

Hey @Alek99 where do I implement this check, I'd like to work on this.

picklelo commented 6 months ago

@TG199 I believe the change would go in this function. I'm unsure how this would impact performance if we're doing network calls for each package, that's something we'd have to be careful about before going forward with this.

TG199 commented 6 months ago

@picklelo Anything in mind to handle this potential issues

picklelo commented 6 months ago

We could somehow only detect the "new packages" that are added and do the check on those. Not sure what the best way for that would be. We can assume all the reflex components have valid components and only check user-made components. If it becomes too complicated I think we just hold off on this issue.