Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: marketplace page header jitter when it in sticky status (#38832)

Joel41683013e373
diff --git a/web/app/components/plugins/marketplace/description/index.tsx b/web/app/components/plugins/marketplace/description/index.tsx
index d2d5f8d50d1..c28d2b28ebd 100644
--- a/web/app/components/plugins/marketplace/description/index.tsx
+++ b/web/app/components/plugins/marketplace/description/index.tsx
@@ -101,6 +101,9 @@ const Description = ({
const header = headerRef.current
if (!container || !header) return
+ const previousOverflowAnchor = container.style.overflowAnchor
+ container.style.overflowAnchor = 'none'
+
let maxHeaderHeight = 0
let lastAppliedOffset = 0
const updateOffset = () => {
@@ -111,12 +114,8 @@ const Description = ({
const baseScrollableTop = Math.max(0, currentScrollableTop - lastAppliedOffset)
const shouldCompensate = baseScrollableTop <= maxHeaderHeight
const nextOffset = shouldCompensate ? collapsedHeight : 0
- const offsetDelta = nextOffset - lastAppliedOffset
-
if (nextOffset > 0) {
container.style.setProperty('--marketplace-header-collapse-offset', `${nextOffset}px`)
- if (offsetDelta !== 0 && container.scrollTop > 0)
- container.scrollTop = Math.max(0, container.scrollTop + offsetDelta)
} else {
container.style.removeProperty('--marketplace-header-collapse-offset')
}
@@ -129,16 +128,17 @@ const Description = ({
if (typeof ResizeObserver === 'undefined') {
return () => {
container.style.removeProperty('--marketplace-header-collapse-offset')
+ container.style.overflowAnchor = previousOverflowAnchor
}
}
const observer = new ResizeObserver(updateOffset)
observer.observe(header)
- observer.observe(container)
return () => {
observer.disconnect()
container.style.removeProperty('--marketplace-header-collapse-offset')
+ container.style.overflowAnchor = previousOverflowAnchor
}
}, [isMarketplacePlatform, scrollContainerId])