-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(insights): Declare module base URLs as constants #70861
Conversation
Bundle ReportChanges will decrease total bundle size by 52.14kB ⬇️
|
@@ -178,7 +179,7 @@ function PageWithProviders({params}: Props) { | |||
return ( | |||
<ModulePageProviders | |||
title={[spanDescription ?? t('(no name)'), t('Pipeline Details')].join(' — ')} | |||
baseURL="/ai-monitoring/" | |||
baseURL={BASE_URL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also includes sentry locale package which you don't need in this file. This could easily come to a point where it effects build time and makes it harder to eliminate dead code. I'm against this pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I see your point, but:
- In this PR, every file that imports
BASE_URL
already importst
, so I'm not introducing a new import - Colocating regular constants and translated strings is a common pattern
If you feel strongly that this pattern is bad, I would love to see proof that it has a meaningful impact on build time, an argument that it's worth sacrificing colocation, and some suggestions on what to do instead
I think the FE TSC or the frontend Slack channel are a more appropriate venue for this, since it needs some discussion. If we all agree, we can introduce this to our developer guidelines and work on improving the situation
In the meantime, is this worth blocking this PR for, or is it a nit? If it's the latter, blocking the PR is probably not appropriate, unless I'm misinterpreting our PR reviewer guidelines
More preparation for moving all insights to the
/insights/
URL namespace.Now that every module is wrapped in
ModulePageProviders
I can set the correctbaseURL
for each one.BASE_URL
is the base URL of the whole module rather than of the page. It's also not the full base URL, only the module itself, relevant to whatever comes before it (usually "/performance"), which is why they don't have starting slashes (except for AI).Most importantly, almost nothing in the app actually uses
baseURL
to construct URLs, so this PR has almost no impact. The only affected links: