diff --git a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts index e6eab33fbd..9317352290 100644 --- a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts @@ -192,6 +192,10 @@ export default class InlineComponentWrapper extends Wrapper { component_opts.properties.push(p`$$inline: true`); } + if (block.type === "slot") { + component_opts.properties.push(p`$$in_slot: true`); + } + const fragment_dependencies = new Set(this.slots.size ? ['$$scope'] : []); this.slots.forEach(slot => { slot.block.dependencies.forEach(name => { diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index f3c763228d..2928947022 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -116,23 +116,25 @@ export function attach_error_handler(that: any, component, fn) { }; } -export function handle_error(component, e) { - if (component.$$.on_error.length === 0) { +export function handle_error(component, e, skip = false) { + if (component.$$.on_error.length === 0 || skip) { bubble_error(component, e); } - component.$$.on_error.forEach(handler => { - try { - handler(e); - } catch (e) { - bubble_error(component, e); - } - }); + if (!skip) { + component.$$.on_error.forEach(handler => { + try { + handler(e); + } catch (e) { + bubble_error(component, e); + } + }); + } } function bubble_error(component, e) { if (component.$$.parent_component) { - handle_error(component.$$.parent_component, e); + handle_error(component.$$.parent_component, e, component.$$.in_slot); } else { throw e; } @@ -166,6 +168,7 @@ export function init(component, options, instance, create_fragment, not_equal, p dirty, skip_bound: false, root: options.target || parent_component.$$.root, + in_slot: options.$$in_slot || false, parent_component };