destroy_effect() — svelte Function Reference
Architecture documentation for the destroy_effect() function in effects.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 410f774f_2d1a_7114_fcba_b292ed7cae3a["destroy_effect()"] 1ae6fa4e_16ee_acdf_5e28_17eb0819fddb["effects.js"] 410f774f_2d1a_7114_fcba_b292ed7cae3a -->|defined in| 1ae6fa4e_16ee_acdf_5e28_17eb0819fddb 3d4087a1_f844_f105_4e79_f5f1a65e1203["hmr()"] 3d4087a1_f844_f105_4e79_f5f1a65e1203 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 4eea2345_5d26_6ea8_43e3_80ca7101b747["error()"] 4eea2345_5d26_6ea8_43e3_80ca7101b747 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 24ab94ca_01c9_1947_75b2_801fb5cac289["destroy_effects()"] 24ab94ca_01c9_1947_75b2_801fb5cac289 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 4133c9ed_6ce6_0847_e62e_62aaf8690ab4["attach()"] 4133c9ed_6ce6_0847_e62e_62aaf8690ab4 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 9a87a496_4e7d_9214_8bba_7bb2e3e47939["attribute_effect()"] 9a87a496_4e7d_9214_8bba_7bb2e3e47939 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 6a7c7098_bda5_0254_e673_2f75f156c2d5["destroy_derived_effects()"] 6a7c7098_bda5_0254_e673_2f75f156c2d5 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 9764bb93_860c_6dee_2112_890b69ee0aa3["create_effect()"] 9764bb93_860c_6dee_2112_890b69ee0aa3 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a cf74814c_38ff_1817_80eb_cbc1bb490472["effect_root()"] cf74814c_38ff_1817_80eb_cbc1bb490472 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 0448eaeb_2934_f939_a81e_5b59a8c48202["component_root()"] 0448eaeb_2934_f939_a81e_5b59a8c48202 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 5ca6cce3_c139_2ec0_550b_59f1139f113b["destroy_effect_children()"] 5ca6cce3_c139_2ec0_550b_59f1139f113b -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 4ea05c55_65be_458d_6860_73b27d2a8b46["destroy_block_effect_children()"] 4ea05c55_65be_458d_6860_73b27d2a8b46 -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 27507f0c_dcab_c3a5_2ce6_5e4b1ef9df3d["pause_effect()"] 27507f0c_dcab_c3a5_2ce6_5e4b1ef9df3d -->|calls| 410f774f_2d1a_7114_fcba_b292ed7cae3a 7eefb76e_3c72_e728_fb79_d79d39793729["remove_effect_dom()"] 410f774f_2d1a_7114_fcba_b292ed7cae3a -->|calls| 7eefb76e_3c72_e728_fb79_d79d39793729 style 410f774f_2d1a_7114_fcba_b292ed7cae3a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/reactivity/effects.js lines 493–541
export function destroy_effect(effect, remove_dom = true) {
var removed = false;
if (
(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&
effect.nodes !== null &&
effect.nodes.end !== null
) {
remove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));
removed = true;
}
destroy_effect_children(effect, remove_dom && !removed);
remove_reactions(effect, 0);
set_signal_status(effect, DESTROYED);
var transitions = effect.nodes && effect.nodes.t;
if (transitions !== null) {
for (const transition of transitions) {
transition.stop();
}
}
execute_effect_teardown(effect);
var parent = effect.parent;
// If the parent doesn't have any children, then skip this work altogether
if (parent !== null && parent.first !== null) {
unlink_effect(effect);
}
if (DEV) {
effect.component_function = null;
}
// `first` and `child` are nulled out in destroy_effect_children
// we don't null out `parent` so that error propagation can work correctly
effect.next =
effect.prev =
effect.teardown =
effect.ctx =
effect.deps =
effect.fn =
effect.nodes =
effect.ac =
null;
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does destroy_effect() do?
destroy_effect() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/reactivity/effects.js.
Where is destroy_effect() defined?
destroy_effect() is defined in packages/svelte/src/internal/client/reactivity/effects.js at line 493.
What does destroy_effect() call?
destroy_effect() calls 6 function(s): destroy_effect_children, execute_effect_teardown, remove_effect_dom, remove_reactions, set_signal_status, unlink_effect.
What calls destroy_effect()?
destroy_effect() is called by 12 function(s): attach, attribute_effect, component_root, create_effect, destroy_block_effect_children, destroy_derived_effects, destroy_effect_children, destroy_effects, and 4 more.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free