mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-19 09:37:43 +02:00
fix(v2): introduce useCollapsible to fix collapsible animation perf issues (#5116)
* fix(v2): avoid slowdown transition with huge sidebar items * move useCollapsible to theme-common * @docusaurus/theme-classic => watch mode should include type-checking * refactor useCollapsible => encapsulate more behavior / state / ref inside it, making code simpler for component using it * useCollapseAnimation => animate DOM properties directly instead of using React inline styles => optimize perf from 4 render per click to 1 render per click * add missing items in deps array * rename ref to collapsibleRef * lint Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
ef70de18dd
commit
237d1a31f5
5 changed files with 201 additions and 54 deletions
|
@ -37,6 +37,12 @@ export {useLocationChange} from './utils/useLocationChange';
|
|||
|
||||
export {usePrevious} from './utils/usePrevious';
|
||||
|
||||
export {useCollapsible} from './utils/useCollapsible';
|
||||
export type {
|
||||
UseCollapsibleConfig,
|
||||
UseCollapsibleReturns,
|
||||
} from './utils/useCollapsible';
|
||||
|
||||
export {
|
||||
useDocsPreferredVersion,
|
||||
useDocsPreferredVersionByPluginId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue