Skip to content

[FIX] Update pages path to match the default one #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

rashidlaasri
Copy link

@rashidlaasri rashidlaasri commented Mar 22, 2025

This PR renames the pages from pages to Pages in the resources/js to align with the default Inertia setup.

Currently, if you create an Inertia test to check if a component is rendered, it fails with a “component not found” error. This happens because Inertia looks for /js/Pages/, while the Starter Kit uses /js/pages/.

$this->get('/podcasts/41')
    ->assertInertia(fn (Assert $page) => $page
        ->component('Podcasts/Show')
        ->has('podcast')
    );

Right now, there are workarounds, but they require extra steps that shouldn't be necessary if we use the default Inertia path.

  1. Publish Inertia config file and update the value:
'page_paths' => [
    resource_path('js/pages'),
],
  1. Override the config file at run time:
config()->set('inertia.testing.page_paths', [resource_path('js/pages')])

While both these changes work, it feels like an extra step (a little bit hacky too) that shouldn't be needed if we used the default path.

Changes in this PR:

✅ Renames the folder to match Inertia’s default path.
✅ Updates app.ts to reflect this change.

This ensures consistency and prevents unnecessary setup issues for users. 🚀

@tnylea tnylea added the Additional Discussion When a PR needs a little additional discussion before merging label Mar 31, 2025
@tnylea
Copy link
Contributor

tnylea commented Mar 31, 2025

Hey @rashidlaasri, thanks for the PR.

We've decided to use lowercase components and pages in the React starter kit. Many conventions use lower-case-components.tsx as a convention in React that we have adopted; however, I totally get what you are saying here.

I'm going to discuss this with Joe (creator of Inertia) and see what the best course of action might be. I'll keep this PR open and post updates here.

Thanks a ton 👏

@tnylea
Copy link
Contributor

tnylea commented Apr 14, 2025

Hey @rashidlaasri, thanks again for the PR.

We are going to publish the inertia config and keep the pages directory lowercase to match all the other directories in the JS folder: #108.

Appreciate it!

@tnylea tnylea closed this Apr 14, 2025
@rashidlaasri rashidlaasri deleted the fix-page_paths branch April 21, 2025 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Additional Discussion When a PR needs a little additional discussion before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants