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

View childViewEvents should support trigger #3247

Merged
merged 2 commits into from
Nov 14, 2016

Conversation

paulfalgout
Copy link
Member

Resolves #2667 and #2464

This makes child events consistently work between both views for both triggerMethod and trigger Currently some bubbling exists between view types. This will add additional bubbling. Previous to having childViewEventPrefix: false I would have been against the bubbling, but it can be managed easily now.

However we may want to wait until childViewEventPrefix: false is the default?

@rafde any other perf concerns? I like the consistency, but realize this might be doing more now.. however since it's regions on a view it is probably not an issue. If you think it is an issue perhaps we should consider breaking CollectionView such that it too only works with triggerMethod ?

I'm bringing this up now as we could introduce this #3244

@rafde
Copy link
Member

rafde commented Nov 3, 2016

Perf concerns.... I will have to run test to find out. Which will goad me to get the perf checker into the repo. Btw, the perf checker will always test against src vs lib.

@paulfalgout
Copy link
Member Author

I wouldn't be so concerned about perf here since you probably don't have 1000 regions on a view like you might have on a collectionview which is already doing this.. except that.. for sufficiently deep views nesting on an existing app this is going to open the door to deep bubbling.. soo that could slow things down if not managed.

@@ -300,7 +300,7 @@ describe('layoutView', function() {
var ChildView = Marionette.View.extend({
template: false,
onRender: function() {
this.triggerMethod('content:rendered');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this signalling a move towards removing triggerMethod in favour of just using trigger everywhere instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly. That'd be #2508

However if this were a childView of a CollectionView then trigger would work. This PR is just about making sure that trigger works in both places.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafde
Copy link
Member

rafde commented Nov 10, 2016

@paulfalgout regarding perf. no noticeable degradation in render time.

@paulfalgout
Copy link
Member Author

I went ahead and added a test so this can get in.

Hopefully the new test and the one that changed doesn't last as they're all pretty awful. #3248

I realized that `view._parent` was no longer in use in most cases and only related to a region.

Then I made the proxy code a little drier and made the proxy cleanup on the region  match the setup
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 2c61276 on paulfalgout:feature/view-support-trigger into 494d1a6 on marionettejs:next.

@paulfalgout
Copy link
Member Author

@marionettejs/marionette-core I just realized that this change warranted some additional code cleanup. Can I get 👀 again?

paulfalgout added a commit to paulfalgout/backbone.marionette that referenced this pull request Nov 11, 2016
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
@rafde
Copy link
Member

rafde commented Nov 14, 2016

I think it all checks out @paulfalgout 👍
I am surprised by how much was removed to allow something very useful to work for both trigger and triggerMethod, it almost seems to good of a change.

@denar90 denar90 merged commit 919c630 into marionettejs:next Nov 14, 2016
@paulfalgout paulfalgout deleted the feature/view-support-trigger branch November 15, 2016 06:05
@paulfalgout paulfalgout added this to the v3.2 milestone Nov 17, 2016
paulfalgout added a commit to paulfalgout/backbone.marionette that referenced this pull request Nov 21, 2016
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
paulfalgout added a commit to paulfalgout/backbone.marionette that referenced this pull request Dec 18, 2016
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
paulfalgout added a commit to paulfalgout/backbone.marionette that referenced this pull request Dec 30, 2016
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
paulfalgout added a commit to paulfalgout/backbone.marionette that referenced this pull request Feb 5, 2017
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
paulfalgout added a commit to paulfalgout/backbone.marionette that referenced this pull request Mar 23, 2017
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
paulfalgout added a commit to paulfalgout/backbone.marionette that referenced this pull request Apr 30, 2017
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
paulfalgout added a commit that referenced this pull request Apr 30, 2017
Until #3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
paulfalgout added a commit that referenced this pull request May 1, 2017
Until #3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants