Skip to content

symmetry : elseBlocks updated twice #57

Closed
@sparecycles

Description

@sparecycles

Just viewing the output tab of https://svelte.technology/repl/?gist=0a4d409dcea5883c47167a55965f03d9

The last line of the update function contains an update of the elseBlock after rendering (or if the elseBlock was already instantiated then it will be updated an additional time).

		update: function ( changed, root ) {
			if ( root.foo ) {
				if ( !ifBlock_0 ) {
					ifBlock_0 = renderIfBlock_0( root, component, target, ifBlock_0_anchor );
				} else {
					ifBlock_0.update( changed, root );
				}
				
				if ( elseBlock_0 ) {
					elseBlock_0.teardown( true );
					elseBlock_0 = null;
				}
			}
			
			else {
				if ( ifBlock_0 ) {
					ifBlock_0.teardown( true );
					ifBlock_0 = null;
				}
				
				if ( !elseBlock_0 ) {
					elseBlock_0 = renderElseBlock_0( root, component, target, ifBlock_0_anchor );
				} else {
					elseBlock_0.update( changed, root );
				}
			}
			if ( elseBlock_0 ) elseBlock_0.update( changed, root );
		},

Consider deleting this line?

update += `\nif ( ${elseName} ) ${elseName}.update( changed, ${generator.current.params} );`;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions