Skip to content

Commit

Permalink
Merge pull request #1 from v7labs/raf-fix
Browse files Browse the repository at this point in the history
fix: wrap the callback in requestAnimationFrame
  • Loading branch information
denishristov committed Feb 1, 2023
2 parents 5098660 + 75c7ced commit 4b94ac6
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 49 deletions.
40 changes: 23 additions & 17 deletions dist/vue-virtual-scroller.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vue-virtual-scroller.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-virtual-scroller.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-virtual-scroller.min.js.map

Large diffs are not rendered by default.

40 changes: 23 additions & 17 deletions dist/vue-virtual-scroller.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vue-virtual-scroller.umd.js.map

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions src/components/DynamicScroller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,24 @@ export default {
provide () {
if (typeof ResizeObserver !== 'undefined') {
this.$_resizeObserver = new ResizeObserver(entries => {
for (const entry of entries) {
if (entry.target) {
const event = new CustomEvent(
'resize',
{
detail: {
contentRect: entry.contentRect,
requestAnimationFrame(() => {
if (!Array.isArray(entries)) {
return
}
for (const entry of entries) {
if (entry.target) {
const event = new CustomEvent(
'resize',
{
detail: {
contentRect: entry.contentRect,
},
},
},
)
entry.target.dispatchEvent(event)
)
entry.target.dispatchEvent(event)
}
}
}
})
})
}
Expand Down

0 comments on commit 4b94ac6

Please sign in to comment.