Repository: sveltejs/svelte
File: packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js (JavaScript)

Code before:
		if (sequence.length === 1 && sequence[0].type === 'Text') {
			skipped += 1;
			state.template.push(sequence[0].raw);
			return;
		}

		state.template.push(' ');

		const { has_state, has_call, value } = build_template_literal(sequence, visit, state);

		// if this is a standalone `{expression}`, make sure we handle the case where
		// no text node was created because the expression was empty during SSR
		const needs_hydration_check = sequence.length === 1;
		const id = flush_node(needs_hydration_check, 'text');

		if (within_bound_contenteditable || !has_state) {
			state.init.push(b.stmt(b.assignment('=', b.member(id, 'nodeValue'), value)));
		} else {
			const update = b.stmt(b.call('$.set_text', id, value));

			if (has_call && !within_bound_contenteditable) {
				state.init.push(build_update(update));
			} else if (has_state && !within_bound_contenteditable) {
				state.update.push(update);
			}
		}
	}

	for (const node of nodes) {
		if (node.type === 'Text' || node.type === 'ExpressionTag') {
			sequence.push(node);
		} else {
			if (sequence.length > 0) {
				flush_sequence(sequence);
				sequence = [];
			}

			let child_state = state;

			if (is_static_element(node)) {
				skipped += 1;
			} else if (node.type === 'EachBlock' && nodes.length === 1 && is_element) {
				node.metadata.is_controlled = true;
			} else {
				const id = flush_node(false, node.type === 'RegularElement' ? node.name : 'node');
				child_state = { ...state, node: id };
			}

			visit(node, child_state);
		}
	}

Review comment (bug):
This can be simplified to

```suggestion
		if (within_bound_contenteditable || !has_state) {
			state.init.push(b.stmt(b.assignment('=', b.member(id, 'nodeValue'), value)));
		} else if (!within_bound_contenteditable) {
			const update = b.stmt(b.call('$.set_text', id, value));

			if (has_call) {
				state.init.push(build_update(update));
			} else if (has_state) {
				state.update.push(update);
			}
        }
```

... which shows that there's now the possibility to not add anything to init or update at all - previously it always did. Is that a bug?

Code after:
		if (sequence.length === 1 && sequence[0].type === 'Text') {
			skipped += 1;
			state.template.push(sequence[0].raw);
			return;
		}

		state.template.push(' ');

		const { has_state, has_call, value } = build_template_literal(sequence, visit, state);

		// if this is a standalone `{expression}`, make sure we handle the case where
		// no text node was created because the expression was empty during SSR
		const is_text = sequence.length === 1;
		const id = flush_node(is_text, 'text');

		const update = b.stmt(b.call('$.set_text', id, value));

		if (has_call && !within_bound_contenteditable) {
			state.init.push(build_update(update));
		} else if (has_state && !within_bound_contenteditable) {
			state.update.push(update);
		} else {
			state.init.push(b.stmt(b.assignment('=', b.member(id, 'nodeValue'), value)));
		}
	}

	for (const node of nodes) {
		if (node.type === 'Text' || node.type === 'ExpressionTag') {
			sequence.push(node);
		} else {
			if (sequence.length > 0) {
				flush_sequence(sequence);
				sequence = [];
			}

			let child_state = state;

			if (is_static_element(node)) {
				skipped += 1;
			} else if (node.type === 'EachBlock' && nodes.length === 1 && is_element) {
				node.metadata.is_controlled = true;
			} else {
				const id = flush_node(false, node.type === 'RegularElement' ? node.name : 'node');
				child_state = { ...state, node: id };
			}

			visit(node, child_state);
		}
	}

	if (sequence.length > 0) {