Skip to content

Client vs Server routing: different results based on path #619

@alexnm

Description

@alexnm

Here's an example folder structure (as silly as it may be)

pages/
  - subpage/
     - index.js
  - subpage.js

If I have a <Link/> point to /subpage/ the client will render the component from subpage.js, but when I refresh the page, I get the subpage/index.js file rendered.

At first I noticed this was an issue with the server routing not working well if the path ends with a /, but then I realized that there are cases in which you may want an index.js in a folder, so it's not necessarily problematic that you get a 404 when you don't have the index.js.

However, when there's a naming collision between a file and a folder, the client and the server behave differently and I think there should be a discussion around this situation, because I can't say there's a clear solution at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions