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

Add url field to routes to build path and use it everywhere #1035

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

LukasKalbertodt
Copy link
Member

Will fix #844

I considered multiple approaches to this. I think having an url field on the route object itself is the nicest, at least for using it. DirectVideoRoute.url({ videoid: ... }) reads very clearly to me. But it wasn't that straight forward to find a way that plays nicely with Typescript.

Adding the url field to Route and keeping every FooRoute as type Route is tricky because (a) in the beginning, not every route will have an url field, and (b) the url builder has different arguments per route, making it generic and more complicated. We certainly want to involve Route somehow such that the match function is well typed without the need to annotate the type of its argument. So yeah, this is what I came up with.

  • Is this a good approach?
  • Is url even the right term? It always just returns a path. Which is an URL... or URI, I can never tell.

Also: hide whitespace changes in githubs diff view when looking at this!

Obviously this is not nearly done, just a tiny proof of concept to get feedback. Which I'd like to get from @JulianKniephoff as well.

@github-actions github-actions bot temporarily deployed to test-deployment-pr1035 December 14, 2023 17:01 Destroyed
@JulianKniephoff
Copy link
Member

Approach looks good to me 👌

@LukasKalbertodt LukasKalbertodt changed the title WIP: add url field to routes to build path Add url field to routes to build path and use it everywhere Dec 18, 2023
@LukasKalbertodt LukasKalbertodt marked this pull request as ready for review December 18, 2023 18:41
@LukasKalbertodt
Copy link
Member Author

Ok I did that for every route and tried to use those functions everywhere. I'm sure I forgot a few places, but that's fine, we can still change them whenever we notice them.

The diff is huge. It gets a lot smaller by "hide whitespace changes". But its still large and annoying to review as its just a refactor. My suggestion is that someone spends at most 5min on this as reviewing this in detail is not a good use of our time IMO.

@github-actions github-actions bot temporarily deployed to test-deployment-pr1035 December 18, 2023 19:26 Destroyed
@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Dec 19, 2023

This comment was marked as resolved.

@LukasKalbertodt LukasKalbertodt added the changelog:dev Changes primarily for developers label Dec 19, 2023
The previous commit once again ran into one of these annoying import
cycles that only error at runtime. Once again I don't have the time to
find a proper solution here, so I just reverted a tiny bit of the last
commit.
@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Jan 11, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1035 January 11, 2024 17:33 Destroyed
@owi92
Copy link
Member

owi92 commented Jan 15, 2024

As suggested, I only glanced over the code changes and didn't read everything in detail. But I did a quick test and everything appears to be working. Since Julian also gave his blessing, I'm merging this now.

@owi92 owi92 merged commit 4b7bf80 into elan-ev:master Jan 15, 2024
2 checks passed
@LukasKalbertodt LukasKalbertodt deleted the route-url-builders branch January 15, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:dev Changes primarily for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add URL-building function for each route
3 participants