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

Portal toasters into app provider + Fix toaster hrefs to include path prefix. #16696

Closed
wants to merge 6 commits into from

Conversation

salazarm
Copy link
Contributor

@salazarm salazarm commented Sep 21, 2023

Summary & Motivation

Fixes #16690

How I Tested These Changes

Locally used --path-prefix and made sure the toast had the correct href

@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-qo740odcm-elementl.vercel.app
https://salazarm-portal-toasters-into-app-provider.components-storybook.dagster-docs.io

Built with commit 68a197b.
This pull request is being automatically deployed with vercel-action

@salazarm salazarm changed the title Portal toasters into app provider Portal toasters into app provider + Fix toaster hrefs to include path prefix. Sep 21, 2023
@salazarm salazarm linked an issue Sep 21, 2023 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-xc9dqj47h-elementl.vercel.app
https://salazarm-portal-toasters-into-app-provider.core-storybook.dagster-docs.io

Built with commit 68a197b.
This pull request is being automatically deployed with vercel-action

@@ -71,6 +71,15 @@ const setup = (instance: ToasterInstance): DToaster => {
</>
);
}
if (rest?.action?.href) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an interesting fix but I am worried this behavior is inconsistent with the rest of the UI kit -- if you make an <a href= or a window.open(href) call, you have to pass the correct href. Why should toaster let you pass an incorrect href and fix it for you?

We have some places like RunUtils.tsx where we already pass the href correctly built from history.createHref. Can you update the callsites that are doing it incorrectly to do it right instead?

I'm worried that these places that ARE doing it right will have the href "double prepended" with the path prefix now.

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alternatively, we could extend the Toaster data to let you specify action: {text: string, to: string} and then have the toaster transform the "to" into an href. I think that'd be consistent with how <Link works and would be nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have some places like RunUtils.tsx where we already pass the href correctly built from history.createHref. Can you update the callsites that are doing it incorrectly to do it right instead?

Yeah I was considering doing that too but the utilities creating the href aren't hooks so they can't access createHref. I guess I can update their callsites to pass the history object from useHistory to them. We could also check if it already has the prefix and if so skip adding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants