File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
packages/svelte/src/compiler/compile/render_dom/wrappers/InlineComponent Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' svelte ' : patch
3+ ---
4+
5+ fix: silence false positive reactive component warning
Original file line number Diff line number Diff line change @@ -105,14 +105,19 @@ export default class InlineComponentWrapper extends Wrapper {
105105 this . slots . set ( name , slot_definition ) ;
106106 }
107107 warn_if_reactive ( ) {
108- const { name } = this . node ;
109- const variable = this . renderer . component . var_lookup . get ( name ) ;
108+ let { name } = this . node ;
109+ const top = name . split ( '.' ) [ 0 ] ; // <T.foo/> etc. should check for T instead of "T.foo"
110+ const variable = this . renderer . component . var_lookup . get ( top ) ;
110111 if ( ! variable ) {
111112 return ;
112113 }
113114 const ignores = extract_ignores_above_node ( this . node ) ;
114115 this . renderer . component . push_ignores ( ignores ) ;
115- if ( variable . reassigned || variable . export_name || variable . is_reactive_dependency ) {
116+ if (
117+ variable . reassigned ||
118+ variable . export_name || // or a prop
119+ variable . mutated
120+ ) {
116121 this . renderer . component . warn ( this . node , compiler_warnings . reactive_component ( name ) ) ;
117122 }
118123 this . renderer . component . pop_ignores ( ) ;
You can’t perform that action at this time.
0 commit comments