log_inconsistent_branches() — svelte Function Reference
Architecture documentation for the log_inconsistent_branches() function in debug.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 4857fe6e_fff2_4d8e_66be_eddbb6b5961a["log_inconsistent_branches()"] fc525dc9_b57a_8bf5_77df_6fcfa5373180["debug.js"] 4857fe6e_fff2_4d8e_66be_eddbb6b5961a -->|defined in| fc525dc9_b57a_8bf5_77df_6fcfa5373180 0911c57a_bb6c_4f52_d50b_08d0065bdbd6["root()"] 4857fe6e_fff2_4d8e_66be_eddbb6b5961a -->|calls| 0911c57a_bb6c_4f52_d50b_08d0065bdbd6 5f2148e6_2541_df61_7418_abc7753d7da6["log_dep()"] 4857fe6e_fff2_4d8e_66be_eddbb6b5961a -->|calls| 5f2148e6_2541_df61_7418_abc7753d7da6 3055ea5a_a5cc_f2b6_42ad_2747f4e1cead["log_effect_tree()"] 4857fe6e_fff2_4d8e_66be_eddbb6b5961a -->|calls| 3055ea5a_a5cc_f2b6_42ad_2747f4e1cead style 4857fe6e_fff2_4d8e_66be_eddbb6b5961a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dev/debug.js lines 340–500
export function log_inconsistent_branches(effect) {
const root_effect = root(effect);
/**
* @typedef {{
* effect: Effect,
* status: 'clean' | 'maybe dirty' | 'dirty',
* parent_clean: boolean,
* children: BranchInfo[]
* }} BranchInfo
*/
/**
* Collects branch effects from the tree
* @param {Effect} eff
* @param {boolean} parent_clean - whether any ancestor branch is clean
* @returns {BranchInfo[]}
*/
function collect_branches(eff, parent_clean) {
/** @type {BranchInfo[]} */
const branches = [];
const flags = eff.f;
const is_branch = (flags & BRANCH_EFFECT) !== 0;
if (is_branch) {
const status =
(flags & CLEAN) !== 0 ? 'clean' : (flags & MAYBE_DIRTY) !== 0 ? 'maybe dirty' : 'dirty';
/** @type {BranchInfo[]} */
const child_branches = [];
let child = eff.first;
while (child !== null) {
child_branches.push(...collect_branches(child, status === 'clean'));
child = child.next;
}
branches.push({
effect: eff,
status,
parent_clean,
children: child_branches
});
} else {
// Not a branch, continue traversing
let child = eff.first;
while (child !== null) {
branches.push(...collect_branches(child, parent_clean));
child = child.next;
}
}
return branches;
}
/**
* Checks if a branch tree contains any inconsistencies (non-clean below clean)
* @param {BranchInfo} branch
* @param {boolean} ancestor_clean
* @returns {boolean}
*/
function has_inconsistency(branch, ancestor_clean) {
const is_inconsistent = ancestor_clean && branch.status !== 'clean';
if (is_inconsistent) return true;
const new_ancestor_clean = ancestor_clean || branch.status === 'clean';
for (const child of branch.children) {
if (has_inconsistency(child, new_ancestor_clean)) return true;
}
return false;
}
/**
* Logs a branch and its children, but only if there are inconsistencies
* @param {BranchInfo} branch
* @param {boolean} ancestor_clean
* @param {number} depth
*/
function log_branch(branch, ancestor_clean, depth) {
const is_inconsistent = ancestor_clean && branch.status !== 'clean';
const new_ancestor_clean = ancestor_clean || branch.status === 'clean';
Domain
Subdomains
Source
Frequently Asked Questions
What does log_inconsistent_branches() do?
log_inconsistent_branches() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dev/debug.js.
Where is log_inconsistent_branches() defined?
log_inconsistent_branches() is defined in packages/svelte/src/internal/client/dev/debug.js at line 340.
What does log_inconsistent_branches() call?
log_inconsistent_branches() calls 3 function(s): log_dep, log_effect_tree, root.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free