-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
Fix sheet height locking too early for filter help #10391
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c7cdced
Attempt at fixing sheet height locking too early
ryan-rushton d023776
Fix problem in search bar using a lazy component and locking sheet he…
ryan-rushton 87fa980
Linting
ryan-rushton 044e57f
Move to interval so we can cancel.
ryan-rushton 531c0d6
Put loading in a portal
ryan-rushton ea1a97c
Comment cleanup
ryan-rushton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import { toggleSearchResults } from 'app/shell/actions'; | |
import { useIsPhonePortrait } from 'app/shell/selectors'; | ||
import { useThunkDispatch } from 'app/store/thunk-dispatch'; | ||
import { isiOSBrowser } from 'app/utils/browsers'; | ||
import { Portal } from 'app/utils/temp-container'; | ||
import clsx from 'clsx'; | ||
import { UseComboboxState, UseComboboxStateChangeOptions, useCombobox } from 'downshift'; | ||
import { AnimatePresence, LayoutGroup, Variants, motion } from 'framer-motion'; | ||
|
@@ -545,21 +546,31 @@ function SearchBar( | |
</LayoutGroup> | ||
|
||
{filterHelpOpen && ( | ||
<Sheet | ||
onClose={() => setFilterHelpOpen(false)} | ||
header={ | ||
<> | ||
<h1>{t('Header.Filters')}</h1> | ||
<UserGuideLink topic="Item-Search" /> | ||
</> | ||
<Suspense | ||
fallback={ | ||
<Portal> | ||
<Loading message={t('Loading.FilterHelp')} /> | ||
</Portal> | ||
Comment on lines
+550
to
+553
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was just going to delete this until I realise the Loading component is a full screen mask. For it to display, I needed to stick it in a portal. To test it, delay the loading using the following
Here is a video of the current state Screen.Recording.2024-05-06.at.9.40.40.AM.mov |
||
} | ||
freezeInitialHeight | ||
sheetClassName={styles.filterHelp} | ||
> | ||
<Suspense fallback={<Loading message={t('Loading.FilterHelp')} />}> | ||
{/* Because FilterHelp suspends, the entire sheet will suspend while it is loaded. | ||
* This stops us having issues with incorrect frozen initial heights as it will | ||
* get locked to the fallback height if we don't do this. | ||
*/} | ||
ryan-rushton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Sheet | ||
onClose={() => setFilterHelpOpen(false)} | ||
header={ | ||
<> | ||
<h1>{t('Header.Filters')}</h1> | ||
<UserGuideLink topic="Item-Search" /> | ||
</> | ||
} | ||
freezeInitialHeight | ||
sheetClassName={styles.filterHelp} | ||
> | ||
<LazyFilterHelp /> | ||
</Suspense> | ||
</Sheet> | ||
</Sheet> | ||
</Suspense> | ||
)} | ||
|
||
{autocompleteMenu} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this is just a slightly better version of the intended functionality. I don't think it is explicitly needed for this fix, but it was something I noticed upon having a read of the code. Happy to remove if requested.
Note: I did it initially with a timeout and a backoff but cancelation came to mind. An interval was just simpler to implement then having to deal with recursive timeouts with a backoff so I did this instead.