Skip to content

Commit faaa9f1

Browse files
Merge pull request #801 from devtron-labs/fix/use-sticky-decimal-width
fix: app details manifest scroll on change of resolution
2 parents 2f8d719 + 8d581ff commit faaa9f1

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.16.0",
3+
"version": "1.16.1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Hooks/useStickyEvent/constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
export const FALLBACK_SENTINEL_HEIGHT = '1px'
17+
export const SENTINEL_HEIGHT_BUFFER = 2
18+
export const FALLBACK_SENTINEL_HEIGHT = `${SENTINEL_HEIGHT_BUFFER}px`
1819
export const OBSERVER_THRESHOLD = 1
19-
export const OBSERVER_ROOT_MARGIN = '0px'
20+
export const OBSERVER_ROOT_MARGIN = '1px'

src/Shared/Hooks/useStickyEvent/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { FALLBACK_SENTINEL_HEIGHT } from './constants'
17+
import { FALLBACK_SENTINEL_HEIGHT, SENTINEL_HEIGHT_BUFFER } from './constants'
1818
import { UseStickyEventReturnType } from './types'
1919

2020
export const getHeightForStickyElementTopOffset = <T extends HTMLElement>({
@@ -30,7 +30,7 @@ export const getHeightForStickyElementTopOffset = <T extends HTMLElement>({
3030
const doesTopOffsetContainCalc = calcRegex.test(topValue)
3131

3232
if (doesTopOffsetContainCalc) {
33-
return topValue.replace(calcRegex, (match) => `calc(${match} + 1px)`)
33+
return topValue.replace(calcRegex, (match) => `calc(${match} + ${SENTINEL_HEIGHT_BUFFER}px)`)
3434
}
3535

3636
return topValue.replace(/\d+(\.\d+)?/g, (match) => {
@@ -40,6 +40,6 @@ export const getHeightForStickyElementTopOffset = <T extends HTMLElement>({
4040
return FALLBACK_SENTINEL_HEIGHT
4141
}
4242

43-
return `${nMatch + 1}`
43+
return `${nMatch + SENTINEL_HEIGHT_BUFFER}`
4444
})
4545
}

0 commit comments

Comments
 (0)