inertiajs / inertia-rails

The Rails adapter for Inertia.js.
https://inertiajs.com
MIT License
529 stars 43 forks source link

Proper case components will not render #107

Open matthewblott opened 11 months ago

matthewblott commented 11 months ago

Like React, the convention for Svelte components is to use proper case (LikeThis) but Rails expects the default paths to be lowercase. It works (so far) if I change it to lowercase but I can see issues going forward and there should be a way to accept components named conventionally.

Below is a screenshot of what I had to do to get the show method to work - either use the more explicit render method with a named path as the first argument or change the .svelte file to lowercase:

Screenshot 2023-10-23 at 17 07 16

BrandonShar commented 11 months ago

Hmm.. I'm not sure we could enable both naming patterns without some heavy handed checks at runtime.

Maybe we could enable this via a setting? Would that solve the issue here?

matthewblott commented 11 months ago

Hi @BrandonShar thanks for the prompt response. Being able to set this somewhere like the base controller should be fine. Every major front end framework uses proper case, I'm surprised it's not come up already.