-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Stop using toJSON for rendering templates #1476
Labels
Milestone
Comments
👍 |
ha this is already done Thanks @thejameskyle for pointing that out :) |
closing in favor of #1599 |
Merged
fixed in #1659 |
Reopening – this references a breaking change that can't happen until v3, hence the milestone. |
Added to #1796 |
jamesplease
added a commit
that referenced
this issue
Jan 7, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
1 task
jamesplease
added a commit
that referenced
this issue
Jan 7, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jamesplease
added a commit
that referenced
this issue
Jan 7, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jamesplease
added a commit
that referenced
this issue
Jan 7, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jamesplease
added a commit
that referenced
this issue
Jan 7, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jamesplease
added a commit
that referenced
this issue
Jan 7, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jamesplease
added a commit
that referenced
this issue
Jan 29, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jamesplease
added a commit
that referenced
this issue
Jan 30, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jamesplease
added a commit
that referenced
this issue
Feb 4, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves #1476
jasonLaster
pushed a commit
to jasonLaster/backbone.marionette
that referenced
this issue
Mar 25, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves marionettejs#1476
jasonLaster
pushed a commit
to jasonLaster/backbone.marionette
that referenced
this issue
Mar 25, 2015
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves marionettejs#1476
ahumphreys87
pushed a commit
to ahumphreys87/backbone.marionette
that referenced
this issue
Aug 21, 2016
toJSON should only be used for preparing data to be sent to the server. In addition, serializeData no longer accepts arguments, distinguishing it further from templateHelpers. Resolves marionettejs#1476
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now we're using toJSON to render templates.
Per this issue, and its resolution, we shouldn't be.
Instead, we should be cloning the attributes object for our templates explicitly. I'm talking
_.clone(model.attributes)
.Your next question might be...why does this matter at all? toJSON does the exact same thing...all it does is clone the attributes.
The difference is use cases. toJSON is called when you're persisting data to the server – it's meant to filter out any data you don't want to save. It's not at all meant to be used in views!
This lets you do things like:
This is a breaking change, but is necessary to get Marionette consistent w. Backbone. It'll also be a huge help to everyone who is trying to do something like the above, which is otherwise really difficult.
The text was updated successfully, but these errors were encountered: