Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Chaplin.Composer #820

Open
IncrediblePony opened this issue Jul 8, 2014 · 1 comment
Open

Chaplin.Composer #820

IncrediblePony opened this issue Jul 8, 2014 · 1 comment

Comments

@IncrediblePony
Copy link

In the Documentation for Chaplin Boilerplate's Composer the given information is incorrect.

The page writes as follows (in the Long form at the bottom of the page):

Long form

By default, when a controller requests a view to be reused, the composer checks if the view instance exists and the new options are the same as before. If that is true the view is destroyed and reused.

The following example shows another way to use the compose method to allow for just about anything. The check method should return true when it wishes the composition to be disposed and the compose method to be called. The composer will track and ensure proper disposal of whatever is returned from the compose method (be it a view or an object with properties that have dispose methods).

This is not right because returning 'true' does NOT destroy the view, it does the exact opposite in my experience.

composeMainView: ->
    @reuse 'todo-main-view',
        compose: ->
            data = amplify.store("todos") ? null
            @collection = new Collection data
            @view = new CollectionView {
                @collection
                region: 'main'
            }
        check: ->
            return @collection.length isnt 0
@albatrocity
Copy link

👍 on this. I think of the check as asking the question "should this view be re-used?

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

No branches or pull requests

2 participants