Skip to content

Commit

Permalink
feat: update to uirouter/core 7.0.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Aug 8, 2020
1 parent cd162a3 commit 0e9e6a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
24 changes: 14 additions & 10 deletions src/directives/viewDirective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,9 @@ uiView = [

let previousEl: JQuery, currentEl: JQuery, currentScope: IScope;

const uiViewId = $view.registerView('ng1', inherited.$uiView.id, name, renderContentIntoUIViewPortal);

scope.$on('$destroy', function () {
trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);
$view.deregisterView(uiViewId);
});

const activeUIView: ActiveUIView = {
$type: 'ng1',
id: uiViewId, // filled in later
id: null, // filled in later
name: name, // ui-view name (<div ui-view="name"></div>
fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, // fully qualified name, describes location in DOM
config: null, // The ViewConfig loaded (from a state.views definition)
Expand All @@ -255,10 +248,14 @@ uiView = [
};

trace.traceUIViewEvent('Linking', activeUIView);
const uiViewId = $view.registerView('ng1', inherited.$uiView.id, name, renderContentIntoUIViewPortal);

$element.data('$uiView', { $uiView: activeUIView });
scope.$on('$destroy', function () {
trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);
$view.deregisterView(uiViewId);
});

renderContentIntoUIViewPortal({ command: 'RENDER_DEFAULT_CONTENT' });
$element.data('$uiView', { $uiView: activeUIView });

function cleanupLastView() {
if (previousEl) {
Expand Down Expand Up @@ -287,6 +284,13 @@ uiView = [
}

function renderContentIntoUIViewPortal(renderCommand: UIViewPortalRenderCommand) {
if (isString(activeUIView) && activeUIView.id !== renderCommand.id) {
throw new Error(
`Received a render command for wrong UIView. Render command id: ${renderCommand.id}, but this UIView id: ${activeUIView.id}`
);
}

activeUIView.id = renderCommand.id;
const viewConfig =
renderCommand.command === 'RENDER_ROUTED_VIEW'
? (renderCommand.routedViewConfig as Ng1ViewConfig)
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,9 @@
eslint-visitor-keys "^1.1.0"

"@uirouter/core@v7beta":
version "7.0.0-beta.1"
resolved "https://registry.yarnpkg.com/@uirouter/core/-/core-7.0.0-beta.1.tgz#294c9a9f82f203ca396763b470093daeef3a8d52"
integrity sha512-jdRQscId7iHWnuSw9xvWNnTDM8QORqP1J5ovtDPtKEW3m0+SfCcKJqQWV6AyXXBFhUIzF+0JmQ8YOoVxDFSBPw==
version "7.0.0-beta.2"
resolved "https://registry.yarnpkg.com/@uirouter/core/-/core-7.0.0-beta.2.tgz#99669b70ef2b27066cc46f167caa1de1a505dcb9"
integrity sha512-ScY+H1n6lyEP5f78CTZlvc8eT5U5NRac0CAZQhy77ExLE4+zg0djyczsHR+omgNfAUndnSx4tqo+DbgjXZfUlw==

"@uirouter/[email protected]":
version "2.5.3"
Expand Down

0 comments on commit 0e9e6a9

Please sign in to comment.