process() — svelte Function Reference
Architecture documentation for the process() function in batch.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 05511be0_1e56_3876_59e2_7350fc912bb9["process()"] 517c145b_769f_b163_6854_d8f2a4412e11["Batch"] 05511be0_1e56_3876_59e2_7350fc912bb9 -->|defined in| 517c145b_769f_b163_6854_d8f2a4412e11 ec59c019_2fd3_2a1c_3cf5_7cd95b795a96["flush()"] ec59c019_2fd3_2a1c_3cf5_7cd95b795a96 -->|calls| 05511be0_1e56_3876_59e2_7350fc912bb9 f618e317_1a72_981e_22c2_44b823813de7["flush_effects()"] f618e317_1a72_981e_22c2_44b823813de7 -->|calls| 05511be0_1e56_3876_59e2_7350fc912bb9 58e25076_0e70_68a7_dbf9_e13ef9845ff2["apply()"] 05511be0_1e56_3876_59e2_7350fc912bb9 -->|calls| 58e25076_0e70_68a7_dbf9_e13ef9845ff2 4774c826_f54f_963c_c1ab_fc51e1b4c790["is_deferred()"] 05511be0_1e56_3876_59e2_7350fc912bb9 -->|calls| 4774c826_f54f_963c_c1ab_fc51e1b4c790 3416434c_0032_c985_24ac_72ce77e06cb3["reset_branch()"] 05511be0_1e56_3876_59e2_7350fc912bb9 -->|calls| 3416434c_0032_c985_24ac_72ce77e06cb3 a199a3f7_5497_5329_2c7c_fc4555548da6["clear()"] 05511be0_1e56_3876_59e2_7350fc912bb9 -->|calls| a199a3f7_5497_5329_2c7c_fc4555548da6 3991a63f_13e1_fb44_3044_00252e1380f3["flush_queued_effects()"] 05511be0_1e56_3876_59e2_7350fc912bb9 -->|calls| 3991a63f_13e1_fb44_3044_00252e1380f3 style 05511be0_1e56_3876_59e2_7350fc912bb9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/reactivity/batch.js lines 185–235
process(root_effects) {
queued_root_effects = [];
this.apply();
/** @type {Effect[]} */
var effects = [];
/** @type {Effect[]} */
var render_effects = [];
for (const root of root_effects) {
this.#traverse_effect_tree(root, effects, render_effects);
// Note: #traverse_effect_tree runs block effects eagerly, which can schedule effects,
// which means queued_root_effects now may be filled again.
// Helpful for debugging reactivity loss that has to do with branches being skipped:
// log_inconsistent_branches(root);
}
if (this.is_deferred()) {
this.#defer_effects(render_effects);
this.#defer_effects(effects);
for (const [e, t] of this.#skipped_branches) {
reset_branch(e, t);
}
} else {
// append/remove branches
for (const fn of this.#commit_callbacks) fn();
this.#commit_callbacks.clear();
if (this.#pending === 0) {
this.#commit();
}
// If sources are written to, then work needs to happen in a separate batch, else prior sources would be mixed with
// newly updated sources, which could lead to infinite loops when effects run over and over again.
previous_batch = this;
current_batch = null;
flush_queued_effects(render_effects);
flush_queued_effects(effects);
previous_batch = null;
this.#deferred?.resolve();
}
batch_values = null;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does process() do?
process() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/reactivity/batch.js.
Where is process() defined?
process() is defined in packages/svelte/src/internal/client/reactivity/batch.js at line 185.
What does process() call?
process() calls 5 function(s): apply, clear, flush_queued_effects, is_deferred, reset_branch.
What calls process()?
process() is called by 2 function(s): flush, flush_effects.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free