Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/young-peaches-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: remove buggy `validate_dynamic_component` check
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,7 @@ export function build_component(node, component_name, context, anchor = context.
b.thunk(/** @type {Expression} */ (context.visit(node.expression))),
b.arrow(
[b.id('$$anchor'), b.id(component_name)],
b.block([
...binding_initializers,
b.stmt(
dev
? b.call('$.validate_dynamic_component', b.thunk(prev(b.id('$$anchor'))))
: prev(b.id('$$anchor'))
)
])
b.block([...binding_initializers, b.stmt(prev(b.id('$$anchor')))])
)
);
};
Expand Down
7 changes: 1 addition & 6 deletions packages/svelte/src/internal/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,7 @@ export {
setContext,
hasContext
} from './runtime.js';
export {
validate_binding,
validate_dynamic_component,
validate_each_keys,
validate_prop_bindings
} from './validate.js';
export { validate_binding, validate_each_keys, validate_prop_bindings } from './validate.js';
export { raf } from './timing.js';
export { proxy } from './proxy.js';
export { create_custom_element } from './dom/elements/custom-element.js';
Expand Down
25 changes: 0 additions & 25 deletions packages/svelte/src/internal/client/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,6 @@ function is_void(tag) {
return void_element_names.test(tag) || tag.toLowerCase() === '!doctype';
}

/**
* @template Component
* @param {() => Component} component_fn
* @returns {Component}
*/
export function validate_dynamic_component(component_fn) {
try {
const instance = component_fn();

if (instance !== undefined && typeof instance !== 'object') {
e.svelte_component_invalid_this_value();
}

return instance;
} catch (err) {
const { message } = /** @type {Error} */ (err);

if (typeof message === 'string' && message.indexOf('is not a function') !== -1) {
e.svelte_component_invalid_this_value();
}

throw err;
}
}

/**
* @param {() => any} collection
* @param {(item: any, index: number) => string} key_fn
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.