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

[docs] Add links for demo in different deploys #26065

Merged
merged 3 commits into from
May 1, 2021

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Apr 30, 2021

demo-links.mp4

Preview: http://deploy-preview-26065--material-ui.netlify.app/components/box

I often find myself switching between a PR and its base branch when doing manual testing. It was a bit annoying to constantly have to adjust these links manually so I just automatically include them now in deploys on mui-org/material (or local development). material-ui.com deploys should be minimally affected due to dead-code-elimination.

Also includes a permalink which was was not that trivial to get (always scrolled through netlify.com).

@eps1lon eps1lon added the docs Improvements or additions to the documentation label Apr 30, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Apr 30, 2021

No bundle size changes

Generated by 🚫 dangerJS against af691bf

@eps1lon eps1lon marked this pull request as ready for review April 30, 2021 09:48
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

I recognize the pain, I have it myself. It looks like something worth testing out 👍

@@ -363,6 +364,71 @@ export default function DemoToolbar(props) {
isFocusableControl,
});

const devMenuItems = [];
if (process.env.STAGING === true) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious. Why not doing

Suggested change
if (process.env.STAGING === true) {
if (process.env.PULL_REQUEST === true) {

As we already do in https://github.com/mui-org/material-ui/blob/33850e52ca32787fbc02b64d3225bac2d451612c/docs/src/modules/utils/getDemoConfig.js#L7

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm curious. Why not doing

Because I would use these links on all material-ui.netlify.app deploys

Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to do the same with the muiCommitRef? I assume that it could work on all deploys as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Could you open a new issue explaining why it would make sense there? I don't understand why this is an issue besides "let's DRY out code at all cost".

Copy link
Member

Choose a reason for hiding this comment

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

I don't think that it's about being DRY. I have asked because not being DRY could suggest that there might be an opportunity to solve a similar problem. It's not really important.

From what I understand, the extra value of using process.env.STAGING === true is to be able to get the menu on https://next--material-ui-x.netlify.app/ and then to compare with master. The value I see in using process.env.STAGING === true for the codesandbox link is to be able to test the behavior on HEAD, before it's released.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, please open a new issue. I don't understand how a link using a codesandbox deploy would look outside of PRs. If it's not about DRY then I understand even less why this is raised here.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see codesandbox-ci build for the baseline branch, It might not work 😁. For the issue, I don't have the incentive to open one (I didn't see a strong pain it could solve). I think that we can snooze this topic.

// eslint-disable-next-line react-hooks/rules-of-hooks -- process.env.STAGING never changes
const router = useRouter();

const defaultReviewID = process.env.GIT_REVIEW_ID ?? '20000';
Copy link
Member

Choose a reason for hiding this comment

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

Should we exit the whole branch instead of defaulting to 20000 if GIT_REVIEW_ID is missing?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a template to get a link to another PR. 20000 is just an arbitrary number to make the PR number apparent in the created link.

docs/src/modules/components/DemoToolbar.js Show resolved Hide resolved
docs/next.config.js Show resolved Hide resolved
@eps1lon eps1lon merged commit 26033fe into mui:next May 1, 2021
@eps1lon eps1lon deleted the docs/branch-switch branch May 1, 2021 08:31
@eps1lon
Copy link
Member Author

eps1lon commented May 1, 2021

/cc @mui-org/maintainers That might be a feature you're interested in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants