-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
Changes from all commits
c7cdced
d023776
87fa980
044e57f
531c0d6
ea1a97c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,30 @@ 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. */} | ||
Comment on lines
+556
to
+558
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. |
||
<Sheet | ||
onClose={() => setFilterHelpOpen(false)} | ||
header={ | ||
<> | ||
<h1>{t('Header.Filters')}</h1> | ||
<UserGuideLink topic="Item-Search" /> | ||
</> | ||
} | ||
freezeInitialHeight | ||
sheetClassName={styles.filterHelp} | ||
> | ||
<LazyFilterHelp /> | ||
</Suspense> | ||
</Sheet> | ||
</Sheet> | ||
</Suspense> | ||
)} | ||
|
||
{autocompleteMenu} | ||
|
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.