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

Don’t share view registry across containers #10599

Merged
merged 3 commits into from
Mar 10, 2015
Merged

Don’t share view registry across containers #10599

merged 3 commits into from
Mar 10, 2015

Commits on Mar 10, 2015

  1. Don’t share view registry across containers

    Previously, all rendered views were inserted into the Ember.View.views
    global hash, indexed by their `elementId`. This hash is used by the
    EventDispatcher to locate views, and is also used by some advanced
    developers as a debugging aid.
    
    Unfortunately, using a global shared store of views is problematic in
    the FastBoot/application instance case, since multiple views with the
    same elementId can exist at the same time. This creates a race condition
    where the second view to be created will throw an exception, as Ember
    believes that a view with that element ID has already been created
    (normally an error in “single app” mode).
    
    This commit introduces the notion of a “view registry”, which is just a
    simple hash injected onto views and shared container-wide. Because each
    application instance in FastBoot has its own container, these views will
    naturally be isolated.
    
    To preserve backwards-compatibility, the default instance created when
    the app is booting normally (i.e., autoboot is `false`) injects the
    global Ember.View.views hash. We should consider removing this entirely
    in Ember 2.0, now that the Container pane of the Inspector gives
    developers easier access to registered views. Do note, however, that the
    Event Dispatcher still has a dependency on the global Ember.View.views,
    though it could be relatively easily refactored to also have the view
    registry injected.
    tomdale committed Mar 10, 2015
    Configuration menu
    Copy the full SHA
    fef509a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    42993e5 View commit details
    Browse the repository at this point in the history
  3. Use less container trickery

    thanks @igorT
    tomdale committed Mar 10, 2015
    1 Configuration menu
    Copy the full SHA
    6a71ff2 View commit details
    Browse the repository at this point in the history