diff --git a/.changeset/gorgeous-flowers-doubt.md b/.changeset/gorgeous-flowers-doubt.md new file mode 100644 index 000000000000..2bc67bc5dd5f --- /dev/null +++ b/.changeset/gorgeous-flowers-doubt.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +[fix] silence prop warnings diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js index 09be6d707ab3..9824fc8def56 100644 --- a/packages/kit/src/runtime/client/client.js +++ b/packages/kit/src/runtime/client/client.js @@ -43,6 +43,7 @@ function update_scroll_positions(index) { scroll_positions[index] = scroll_state(); } +// TODO remove for 1.0 /** @type {Record} */ let warned_about_attributes = {}; @@ -1545,25 +1546,26 @@ function add_url_properties(type, target) { function pre_update() { if (__SVELTEKIT_DEV__) { - // Nasty hack to silence harmless warnings the user can do nothing about - const warn = console.warn; - console.warn = (...args) => { - if ( - args.length === 1 && - /<(Layout|Page)(_[\w$]+)?> was created (with unknown|without expected) prop '(data|form)'/.test( - args[0] - ) - ) { - return; - } - warn(...args); - }; - return () => { - tick().then(() => (console.warn = warn)); check_for_removed_attributes(); }; } return () => {}; } + +if (__SVELTEKIT_DEV__) { + // Nasty hack to silence harmless warnings the user can do nothing about + const warn = console.warn; + console.warn = (...args) => { + if ( + args.length === 1 && + /<(Layout|Page)(_[\w$]+)?> was created (with unknown|without expected) prop '(data|form)'/.test( + args[0] + ) + ) { + return; + } + warn(...args); + }; +}