Skip to content

Commit d2ab978

Browse files
authored
deduplicate
1 parent 1740624 commit d2ab978

File tree

1 file changed

+15
-16
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+15
-16
lines changed

packages/svelte/src/internal/client/dom/blocks/boundary.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,7 @@ export class Boundary {
159159
this.#hydrate_resolved_content();
160160
}
161161
} else {
162-
var anchor = this.#anchor;
163-
164-
if (this.#pending) {
165-
this.#pending_anchor = create_text();
166-
this.#anchor.before(this.#pending_anchor);
167-
168-
anchor = this.#pending_anchor;
169-
}
162+
var anchor = this.#get_anchor();
170163

171164
try {
172165
this.#main_effect = branch(() => children(anchor));
@@ -211,14 +204,7 @@ export class Boundary {
211204
this.#pending_effect = branch(() => pending(this.#anchor));
212205

213206
Batch.enqueue(() => {
214-
var anchor = this.#anchor;
215-
216-
if (this.#pending) {
217-
this.#pending_anchor = create_text();
218-
this.#anchor.before(this.#pending_anchor);
219-
220-
anchor = this.#pending_anchor;
221-
}
207+
var anchor = this.#get_anchor();
222208

223209
this.#main_effect = this.#run(() => {
224210
Batch.ensure();
@@ -237,6 +223,19 @@ export class Boundary {
237223
});
238224
}
239225

226+
#get_anchor() {
227+
var anchor = this.#anchor;
228+
229+
if (this.#pending) {
230+
this.#pending_anchor = create_text();
231+
this.#anchor.before(this.#pending_anchor);
232+
233+
anchor = this.#pending_anchor;
234+
}
235+
236+
return anchor;
237+
}
238+
240239
/**
241240
* Returns `true` if the effect exists inside a boundary whose pending snippet is shown
242241
* @returns {boolean}

0 commit comments

Comments
 (0)