Skip to content
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

Behavior of /[dynamic].ext routes together with /static.ext #475

Open
synalice opened this issue Jul 7, 2022 · 6 comments · May be fixed by #1568
Open

Behavior of /[dynamic].ext routes together with /static.ext #475

synalice opened this issue Jul 7, 2022 · 6 comments · May be fixed by #1568
Labels
good first issue Good for newcomers

Comments

@synalice
Copy link
Contributor

synalice commented Jul 7, 2022

Proposing a feature of an error (or a warning) being returned to the developer when trying to create a single /[dynamic].ext route in the same folder with /static.ext routes, or when creating multiple /[dynamic].ext routes in the same folder. Doing this may lead to an unexpected behavior and thus should be discouraged.

Screenshot from 2022-07-08 00-40-35
It should be obvious which file will be returned instead of Fresh choosing one over the other.

Related issue: #461

@iamsahilsonawane
Copy link
Contributor

iamsahilsonawane commented Jul 8, 2022

@synalice I think it uses the static routes first over the dynamic ones (priority wise).

It works fine creating a new project and adding static routes on the relative path to dynamic ones

Recording example: https://user-images.githubusercontent.com/47249618/177854292-b182fb60-6600-4e48-a962-7afbdf2a79cc.mp4

@synalice
Copy link
Contributor Author

synalice commented Jul 8, 2022

@iamsahilsonawane, yes, I know it does choose static over the dynamic and works fine. What I'm saying is that most of the time it wouldn't be a wise decision to put dynamic routes together with static, and the developer should be warned about what's he doing.

@iamsahilsonawane
Copy link
Contributor

@iamsahilsonawane, yes, I know it does choose static over the dynamic and works fine. What I'm saying is that most of the time it wouldn't be a wise decision to put dynamic routes together with static, and the developer should be warned about what's he doing.

Yes, I see, I think there should be lints implemented for this

@nhc
Copy link

nhc commented Jul 15, 2022

I would be interested in helping with this (and getting involved generally)

@lucacasonato - you tagged good-first-issue

Would you (or anyone) be able to give any pointers as to where and how you would like the warning to be shown? I'm currently thinking it would show in the terminal output where the developer has started the process?

@iamsahilsonawane
Copy link
Contributor

Would you (or anyone) be able to give any pointers as to where and how you would like the warning to be shown? I'm currently thinking it would show in the terminal output where the developer has started the process?

IMO yes, there should be a warning in the terminal. Also, these warnings should be reflected in the docs.

@nhc
Copy link

nhc commented Jul 16, 2022

IMO yes, there should be a warning in the terminal. Also, these warnings should be reflected in the docs.

Ok sure I can have a go a figuring this out.

nhc added a commit to nhc/fresh that referenced this issue Jul 23, 2022
nhc added a commit to nhc/fresh that referenced this issue Jul 23, 2022
nhc added a commit to nhc/fresh that referenced this issue Jul 23, 2022
nhc added a commit to nhc/fresh that referenced this issue Jul 23, 2022
@mbhrznr mbhrznr linked a pull request Sep 4, 2023 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
4 participants