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

Migrate from "data" to "input" #549

Closed
patrick-steele-idem opened this issue Jan 27, 2017 · 0 comments
Closed

Migrate from "data" to "input" #549

patrick-steele-idem opened this issue Jan 27, 2017 · 0 comments
Assignees
Labels
type:feature A feature request
Milestone

Comments

@patrick-steele-idem
Copy link
Contributor

Marko has always had a special data variable that referenced the input object to the template. Calling it data has lead to various inconsistencies. UI components have an onInput(input) method. In this case, the input argument refers to what becomes the data variable. Obviously the first parameter to onInput() can be named whatever, but input is a better fit. For better clarity and more consistency throughout we want to switch from data to input (while still maintaining backwards compatibility).

For the first phase we will rename the data parameter to input for the compiled template's render() function and add a local variable named data that references the new input variable (var data = input;).

As a follow up we will do static code analysis to only add the var data = input; line if the template references the old data variable (we will also add a deprecation warning when we find that a compiled template references the old data variable)).

We are also exploring the option of automatically persisting the input object passed to the UI component as part of the widget instance so that it is automatically available during a rerender (currently only state is persisted). If we make this change then the input would be available as this.input on the widget instance and it would also be serialized from the server to the browser.

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

No branches or pull requests

1 participant