Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Literals in props should not be updated #1394

Closed
Rich-Harris opened this issue May 1, 2018 · 1 comment · Fixed by #1401
Closed

Literals in props should not be updated #1394

Rich-Harris opened this issue May 1, 2018 · 1 comment · Fixed by #1401

Comments

@Rich-Harris
Copy link
Member

In a case like this...

<List items='{[1, 2, 3]}'/>

...items should never be updated, even if <List> had other properties that were being updated.

@Rich-Harris
Copy link
Member Author

To clarify:

function create_main_fragment(component, ctx) {

	var list_initial_data = { items: [1, 2, 3] };
	var list = new List({
		root: component.root,
		data: list_initial_data
	});

	return {
		c: function create() {
			list._fragment.c();
		},

		m: function mount(target, anchor) {
			list._mount(target, anchor);
		},

+		p: noop,
-		p: function update(changed, ctx) {
-			var list_changes = {};
-			list_changes.items = [1, 2, 3];
-			list._set(list_changes);
-		},

		u: function unmount() {
			list._unmount();
		},

		d: function destroy() {
			list.destroy(false);
		}
	};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants