Skip to content

Commit

Permalink
fixed anchor position caching
Browse files Browse the repository at this point in the history
  • Loading branch information
PluTiper committed Sep 18, 2024
1 parent 91c6bfb commit 00d0234
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/anchor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ export default function (Alpine) {

if (! reference) throw 'Alpine: no element provided to x-anchor...'

let previousValue
let compute = () => {
let previousValue

computePosition(reference, el, {
placement,
middleware: [flip(), shift({padding: 5}), offset(offsetValue)],
Expand All @@ -35,9 +34,8 @@ export default function (Alpine) {
if (JSON.stringify({ x, y }) !== previousValue) {
el._x_anchor.x = x
el._x_anchor.y = y
previousValue = JSON.stringify({ x, y })
}

previousValue = JSON.stringify({ x, y })
})
}

Expand Down

0 comments on commit 00d0234

Please sign in to comment.