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

SelectPanel2: 3 tiny bug fixes #3770

Merged
merged 5 commits into from
Oct 2, 2023
Merged

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented Sep 26, 2023

Fix 1

In #3758, I forgot that we would need to add Suspense support to useSlots first before making footer optional. Default header is fine because it can't be wrapped in suspense, but footer totally can be.

Haven't tried to update useSlots yet, will explore later.

Before After
Select panel with two footers! Select panel with one footer

Fix 2

The menu was not closing on it's own because I made a silly mistake. We will be able to catch these silly things once I write some tests 😅

- if (props.open === 'undefined') setInternalOpen(false)
+ if (props.open === undefined) setInternalOpen(false)

Fix 3

Added a warning to the ActionMenu story because it's implementation will most definitely change once we implement SelectPanel as a modal

SelectPanel story with a banner that says This implementation will most likely change. [See decision log for more details.](https://github.com/github/primer/discussions/2614#discussioncomment-6879407)

@siddharthkp siddharthkp added the skip changeset This change does not need a changelog label Sep 26, 2023
@siddharthkp siddharthkp requested review from broccolinisoup and a team September 26, 2023 17:07
@siddharthkp siddharthkp self-assigned this Sep 26, 2023
@changeset-bot
Copy link

changeset-bot bot commented Sep 26, 2023

⚠️ No Changeset found

Latest commit: f046646

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 26, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 104.36 KB (0%)
dist/browser.umd.js 104.94 KB (0%)

@siddharthkp siddharthkp temporarily deployed to github-pages September 26, 2023 17:14 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3770 September 26, 2023 17:15 Inactive
@joshblack
Copy link
Member

we would need to add Suspense support to useSlots first before making footer optional

Just wanted to ask, is it possible for useSlots to be Suspense-compatible? I would have thought that React.Children and Suspense would be incompatible and was curious how this will work 👀

@primer primer bot temporarily deployed to github-pages September 26, 2023 18:54 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3770 September 26, 2023 18:55 Inactive
@siddharthkp siddharthkp changed the base branch from main to lol-sid September 26, 2023 19:13
Base automatically changed from lol-sid to main September 26, 2023 21:46
@siddharthkp
Copy link
Member Author

Just wanted to ask, is it possible for useSlots to be Suspense-compatible?

I think so, i have a rough idea. But, I might be wrong. Will find out, I guess :)

if (typeof props.onCancel === 'function') props.onCancel()
}
// @ts-ignore todo
const onInternalSubmit = event => {
event.preventDefault()
if (props.open === 'undefined') setInternalOpen(false)
if (props.open === undefined) setInternalOpen(false)
Copy link
Member

Choose a reason for hiding this comment

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

I think you fixed it in the other PR, no? #3770

Copy link
Member Author

@siddharthkp siddharthkp Sep 28, 2023

Choose a reason for hiding this comment

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

This is that PR :)

I've put it in both PRs, but I intent to merge this PR first and then #3764

Copy link
Member

@broccolinisoup broccolinisoup Sep 29, 2023

Choose a reason for hiding this comment

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

This is that PR :)

🙈

@@ -105,7 +105,7 @@ const SelectPanel = props => {
{slots.header || <SelectPanel.Header />}
{childrenInBody}
{/* render default footer as fallback */}
{slots.footer || <SelectPanel.Footer />}
{slots.footer}
Copy link
Member

Choose a reason for hiding this comment

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

I forgot that we would need to add Suspense support to useSlots first before making footer optional.

This is probably my ignorance but what is the reason of wrapping the footer in Suspense? 🤔

Copy link
Member Author

@siddharthkp siddharthkp Sep 28, 2023

Choose a reason for hiding this comment

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

If we need to fetch data before rendering the list, we'd like the footer to also be hidden until then.

So it's wrapped in the same Suspense boundary as list

Screen.Recording.2023-09-28.at.4.01.41.PM.mov

Copy link
Member

Choose a reason for hiding this comment

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

Ahh that makes sense!!

@siddharthkp siddharthkp added this pull request to the merge queue Oct 2, 2023
Merged via the queue into main with commit 6e9977d Oct 2, 2023
31 checks passed
@siddharthkp siddharthkp deleted the drafts-selectpanel-footer-fix branch October 2, 2023 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changeset This change does not need a changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants