-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(portal): fix deployment history/api mappings table is not full he…
…ight (#240)
- Loading branch information
1 parent
c8c1000
commit 81cee3f
Showing
8 changed files
with
54 additions
and
34 deletions.
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
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
25 changes: 25 additions & 0 deletions
25
kraken-app/kraken-app-portal/src/hooks/useContainerHeight.ts
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { debounce } from "lodash"; | ||
import { useEffect, useState } from "react"; | ||
|
||
export function useContainerHeight(containerRef: React.MutableRefObject<HTMLDivElement | null>) { | ||
const [scrollHeight, setScrollHeight] = useState(0) | ||
|
||
const debounced = debounce((value: number) => setScrollHeight(value), 500) | ||
|
||
useEffect(() => { | ||
const onResized = () => { | ||
const { height = 0 } = containerRef.current?.getBoundingClientRect() ?? {} | ||
debounced(height) | ||
} | ||
|
||
window.addEventListener('resize', onResized) | ||
|
||
setTimeout(() => window.dispatchEvent(new Event('resize')), 1000) | ||
|
||
return () => { | ||
window.removeEventListener('resize', onResized) | ||
} | ||
}, []) | ||
|
||
return [scrollHeight] | ||
} |
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
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 |
---|---|---|
|
@@ -26,4 +26,7 @@ export default defineConfig({ | |
}, | ||
}, | ||
}, | ||
optimizeDeps: { | ||
exclude: ['node_modules/*'] | ||
} | ||
}); |