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

ref: improve links inside AddCodeOwnerModal #83672

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

ryan953
Copy link
Member

@ryan953 ryan953 commented Jan 17, 2025

Link should have a trailing / and should not have "undefined" in any path segment.

The way these links are constructed it's possible to have /undefined/ inside the url because of the optional types involved. This change makes the types slightly better in the *MappingLink fields, and will return empty string instead of "undefined" if needed.

The url that these links point to is: /settings/${organization.slug}/integrations/ which should have a trailing slash in all cases.
If the provider.key or integrationId segments are missing then a url of /settings/${organization.slug}/integrations/// is perfectly fine, and will take the user to the same page as /settings/${organization.slug}/integrations/. However a url of /settings/${organization.slug}/integrations/undefined// will show an error on the screen. With the defaults added the error screen should not be possible anymore.

@ryan953 ryan953 requested a review from a team as a code owner January 17, 2025 20:04
@ryan953 ryan953 requested a review from a team January 17, 2025 20:04
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 17, 2025
@@ -292,7 +292,6 @@ function ErrorMessage({
errorJSON: {raw?: string} | null;
}) {
const codeMapping = codeMappings.find(mapping => mapping.id === codeMappingId);
const {integrationId, provider} = codeMapping as RepositoryProjectPathConfig;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to force RepositoryProjectPathConfig type here, we have the codeMapping && guard, and typescript can understand the refinement if we type codeMapping.integrationId instead of destructuring.

@ryan953 ryan953 changed the title ref: improve links inside AddCodeOwnerModal so they have trailing / a… ref: improve links inside AddCodeOwnerModal Jan 17, 2025
@ryan953 ryan953 merged commit da81017 into master Jan 17, 2025
46 checks passed
@ryan953 ryan953 deleted the ryan953/ref-addCodeOwnerModal-links branch January 17, 2025 20:47
andrewshie-sentry pushed a commit that referenced this pull request Jan 22, 2025
Link should have a trailing `/` and should not have "undefined" in any
path segment.


The way these links are constructed it's possible to have `/undefined/`
inside the url because of the optional types involved. This change makes
the types slightly better in the `*MappingLink` fields, and will return
empty string instead of `"undefined"` if needed.

The url that these links point to is:
`/settings/${organization.slug}/integrations/` which should have a
trailing slash in all cases.
If the `provider.key` or `integrationId` segments are missing then a url
of `/settings/${organization.slug}/integrations///` is perfectly fine,
and will take the user to the same page as
`/settings/${organization.slug}/integrations/`. However a url of
`/settings/${organization.slug}/integrations/undefined//` will show an
error on the screen. With the defaults added the error screen should not
be possible anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants