Skip to content

Commit bbdfb77

Browse files
committed
Prepare structural scheduling for review
1 parent 19d24d2 commit bbdfb77

3 files changed

Lines changed: 4 additions & 124 deletions

File tree

‎STRUCTURAL-SCHEDULING.md‎

Lines changed: 0 additions & 118 deletions
This file was deleted.

‎packages/alpinejs/src/reactivity.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { scheduler, startTransaction as startTx, commitTransaction as commitTx } from './scheduler'
33

44
let reactive, effect, release, raw
5-
let nextStructuralEffectPriority = 0
5+
let nextStructuralEffectOrder = 0
66

77
let shouldSchedule = true
88
export function disableEffectScheduling(callback) {
@@ -33,9 +33,9 @@ export function elementBoundEffect(el) {
3333

3434
let wrappedEffect = (callback, options) => {
3535
// Effects run immediately and can create nested structural effects, so
36-
// reserve the parent's priority before invoking the effect callback.
36+
// reserve the parent's order before invoking the effect callback.
3737
let priority = options?.priority === 'structural'
38-
? nextStructuralEffectPriority++
38+
? nextStructuralEffectOrder++
3939
: undefined
4040
let effectReference = effect(callback)
4141

‎packages/alpinejs/src/scheduler.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ function queueJob(job) {
3030
export function dequeueJob(job) {
3131
let index = queue.indexOf(job)
3232

33-
if (index !== -1 && index > lastFlushedIndex) {
34-
queue.splice(index, 1)
35-
}
33+
if (index !== -1 && index > lastFlushedIndex) queue.splice(index, 1)
3634
}
3735

3836
function queueFlush() {

0 commit comments

Comments
 (0)