shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 242 forks source link

Vex Modal promise & rxjs error on dialog-ref.close and dialog-ref.dismiss #179

Closed orange4glace closed 8 years ago

orange4glace commented 8 years ago

Tested on both angular2 version rc5 and .rc6 with angular2-modal version beta12

(based on a clean angular2-seed)

With Vex Modal Module (but works well with Bootstrap modal module)

When close is called (error occurs after animation ends):

core.umd.js:5995 EXCEPTION: Uncaught (in promise): undefinedErrorHandler.handleError @ core.umd.js:5995next @ core.umd.js:9458schedulerFn @ core.umd.js:8705SafeSubscriber.__tryOrUnsub @ Subscriber.ts:238SafeSubscriber.next @ Subscriber.ts:190Subscriber._next @ Subscriber.ts:135Subscriber.next @ Subscriber.ts:95Subject.next @ Subject.ts:61EventEmitter.emit @ core.umd.js:8697onError @ core.umd.js:8922onHandleError @ core.umd.js:8793ZoneDelegate.handleError @ zone.js?1472885153106:336Zone.runGuarded @ zone.js?1472885153106:242_loop_1 @ zone.js?1472885153106:508drainMicroTaskQueue @ zone.js?1472885153106:515ZoneTask.invoke @ zone.js?1472885153106:437
core.umd.js:6000 ORIGINAL STACKTRACE:ErrorHandler.handleError @ core.umd.js:6000next @ core.umd.js:9458schedulerFn @ core.umd.js:8705SafeSubscriber.__tryOrUnsub @ Subscriber.ts:238SafeSubscriber.next @ Subscriber.ts:190Subscriber._next @ Subscriber.ts:135Subscriber.next @ Subscriber.ts:95Subject.next @ Subject.ts:61EventEmitter.emit @ core.umd.js:8697onError @ core.umd.js:8922onHandleError @ core.umd.js:8793ZoneDelegate.handleError @ zone.js?1472885153106:336Zone.runGuarded @ zone.js?1472885153106:242_loop_1 @ zone.js?1472885153106:508drainMicroTaskQueue @ zone.js?1472885153106:515ZoneTask.invoke @ zone.js?1472885153106:437
core.umd.js:6001 Error: Uncaught (in promise): undefined
    at resolvePromise (zone.js?1472885153106:558)
    at PromiseCompleter.reject (zone.js?1472885153106:535)
    at _dismiss (dialog-ref.ts:82)
    at ZoneDelegate.invoke (zone.js?1472885153106:332)
    at Object.onInvoke (core.umd.js:8772)
    at ZoneDelegate.invoke (zone.js?1472885153106:331)
    at Zone.run (zone.js?1472885153106:225)
    at zone.js?1472885153106:591
    at ZoneDelegate.invokeTask (zone.js?1472885153106:365)
    at Object.onInvokeTask (core.umd.js:8763)ErrorHandler.handleError @ core.umd.js:6001next @ core.umd.js:9458schedulerFn @ core.umd.js:8705SafeSubscriber.__tryOrUnsub @ Subscriber.ts:238SafeSubscriber.next @ Subscriber.ts:190Subscriber._next @ Subscriber.ts:135Subscriber.next @ Subscriber.ts:95Subject.next @ Subject.ts:61EventEmitter.emit @ core.umd.js:8697onError @ core.umd.js:8922onHandleError @ core.umd.js:8793ZoneDelegate.handleError @ zone.js?1472885153106:336Zone.runGuarded @ zone.js?1472885153106:242_loop_1 @ zone.js?1472885153106:508drainMicroTaskQueue @ zone.js?1472885153106:515ZoneTask.invoke @ zone.js?1472885153106:437
zone.js?1472885153106:486 Error: Uncaught (in promise): undefined(…)

line that occurs an error

  private _destroy(): void {
    this._onDestroy.next(null);
    this._onDestroy.complete();
    **this.overlayRef.destroy()**
  }

When dismiss is called (error occurs immediately and stop working)

browser_adapter.js:84 EXCEPTION: ObjectUnsubscribedErrorBrowserDomAdapter.logError @ browser_adapter.js:84BrowserDomAdapter.logGroup @ browser_adapter.js:94ExceptionHandler.call @ exception_handler.js:65next @ application_ref.js:348schedulerFn @ async.js:89SafeSubscriber.__tryOrUnsub @ Subscriber.js:225SafeSubscriber.next @ Subscriber.js:174Subscriber._next @ Subscriber.js:124Subscriber.next @ Subscriber.js:88Subject._finalNext @ Subject.js:128Subject._next @ Subject.js:120Subject.next @ Subject.js:77EventEmitter.emit @ async.js:77onError @ ng_zone.js:124onHandleError @ ng_zone_impl.js:74ZoneDelegate.handleError @ zone.js:336Zone.runTask @ zone.js:268ZoneTask.invoke @ zone.js:433
browser_adapter.js:84 STACKTRACE:BrowserDomAdapter.logError @ browser_adapter.js:84ExceptionHandler.call @ exception_handler.js:67next @ application_ref.js:348schedulerFn @ async.js:89SafeSubscriber.__tryOrUnsub @ Subscriber.js:225SafeSubscriber.next @ Subscriber.js:174Subscriber._next @ Subscriber.js:124Subscriber.next @ Subscriber.js:88Subject._finalNext @ Subject.js:128Subject._next @ Subject.js:120Subject.next @ Subject.js:77EventEmitter.emit @ async.js:77onError @ ng_zone.js:124onHandleError @ ng_zone_impl.js:74ZoneDelegate.handleError @ zone.js:336Zone.runTask @ zone.js:268ZoneTask.invoke @ zone.js:433
browser_adapter.js:84 
  -------------   Elapsed: 1253 ms; At: Sat Sep 03 2016 16:01:21 GMT+0900 (대한민국 표준시)   -------------  
    at Object.onScheduleTask (http://localhost:3000/polyfills.bundle.js:16076:23)
    at ZoneDelegate.scheduleTask (http://localhost:3000/polyfills.bundle.js:16480:50)
    at Zone.scheduleEventTask (http://localhost:3000/polyfills.bundle.js:16423:40)
    at zoneAwareAddEventListener (http://localhost:3000/polyfills.bundle.js:17053:11)
    at HTMLElement.addEventListener (eval at createNamedFn (http://localhost:3000/polyfills.bundle.js:17149:18), <anonymous>:3:43)
    at http://localhost:3000/main.bundle.js:352:17
    at Array.forEach (native)
    at register (http://localhost:3000/main.bundle.js:351:20)
  -------------   Elapsed: 15 ms; At: Sat Sep 03 2016 16:01:21 GMT+0900 (대한민국 표준시)   -------------  
    at Object.onScheduleTask (http://localhost:3000/polyfills.bundle.js:16076:23)
    at ZoneDelegate.scheduleTask (http://localhost:3000/polyfills.bundle.js:16480:50)
    at Zone.scheduleMicroTask (http://localhost:3000/polyfills.bundle.js:16417:40)
    at scheduleResolveOrReject (http://localhost:3000/polyfills.bundle.js:16727:15)
    at resolvePromise (http://localhost:3000/polyfills.bundle.js:16691:22)
    at http://localhost:3000/polyfills.bundle.js:16673:14
    at SafeSubscriber._complete (http://localhost:3000/vendor.bundle.js:32946:122)
    at SafeSubscriber.__tryOrUnsub (http://localhost:3000/vendor.bundle.js:7104:16)
  -------------   Elapsed: 0 ms; At: Sat Sep 03 2016 16:01:21 GMT+0900 (대한민국 표준시)   -------------  
    at Object.onScheduleTask (http://localhost:3000/polyfills.bundle.js:16076:23)
    at ZoneDelegate.scheduleTask (http://localhost:3000/polyfills.bundle.js:16480:50)
    at Zone.scheduleMicroTask (http://localhost:3000/polyfills.bundle.js:16417:40)
    at scheduleResolveOrReject (http://localhost:3000/polyfills.bundle.js:16727:15)
    at resolvePromise (http://localhost:3000/polyfills.bundle.js:16691:22)
    at http://localhost:3000/polyfills.bundle.js:16729:18
    at ZoneDelegate.invokeTask (http://localhost:3000/polyfills.bundle.js:16503:38)
    at Object.onInvokeTask (http://localhost:3000/vendor.bundle.js:45814:41)
  -------------   Elapsed: 1 ms; At: Sat Sep 03 2016 16:01:21 GMT+0900 (대한민국 표준시)   -------------  
    at Object.onScheduleTask (http://localhost:3000/polyfills.bundle.js:16076:23)
    at ZoneDelegate.scheduleTask (http://localhost:3000/polyfills.bundle.js:16480:50)
    at Zone.scheduleMicroTask (http://localhost:3000/polyfills.bundle.js:16417:40)
    at scheduleResolveOrReject (http://localhost:3000/polyfills.bundle.js:16727:15)
    at ZoneAwarePromise.then (http://localhost:3000/polyfills.bundle.js:16805:18)
    at resolveNode (http://localhost:3000/vendor.bundle.js:62600:81)
    at http://localhost:3000/vendor.bundle.js:62606:57
    at Array.map (native)
  -------------   Elapsed: 12 ms; At: Sat Sep 03 2016 16:01:21 GMT+0900 (대한민국 표준시)   -------------  
    at Object.onScheduleTask (http://localhost:3000/polyfills.bundle.js:16076:23)
    at ZoneDelegate.scheduleTask (http://localhost:3000/polyfills.bundle.js:16480:50)
    at Zone.scheduleMicroTask (http://localhost:3000/polyfills.bundle.js:16417:40)
    at scheduleResolveOrReject (http://localhost:3000/polyfills.bundle.js:16727:15)
    at ZoneAwarePromise.then (http://localhost:3000/polyfills.bundle.js:16805:18)
    at Router.scheduleNavigation (http://localhost:3000/vendor.bundle.js:13789:34)
    at Router.navigateByUrl (http://localhost:3000/vendor.bundle.js:13737:25)
    at Router.initialNavigation (http://localhost:3000/vendor.bundle.js:13612:14)
  -------------   Elapsed: 25 ms; At: Sat Sep 03 2016 16:01:21 GMT+0900 (대한민국 표준시)   -------------  
    at Object.onScheduleTask (http://localhost:3000/polyfills.bundle.js:16076:23)
    at ZoneDelegate.scheduleTask (http://localhost:3000/polyfills.bundle.js:16480:50)
    at Zone.scheduleMicroTask (http://localhost:3000/polyfills.bundle.js:16417:40)
    at scheduleResolveOrReject (http://localhost:3000/polyfills.bundle.js:16727:15)
    at resolvePromise (http://localhost:3000/polyfills.bundle.js:16691:22)
    at http://localhost:3000/polyfills.bundle.js:16729:18
    at ZoneDelegate.invokeTask (http://localhost:3000/polyfills.bundle.js:16503:38)
    at Object.onInvokeTask (http://localhost:3000/vendor.bundle.js:45814:41)
  -------------   Elapsed: 2 ms; At: Sat Sep 03 2016 16:01:21 GMT+0900 (대한민국 표준시)   -------------  
    at Object.onScheduleTask (http://localhost:3000/polyfills.bundle.js:16076:23)
    at ZoneDelegate.scheduleTask (http://localhost:3000/polyfills.bundle.js:16480:50)
    at Zone.scheduleMicroTask (http://localhost:3000/polyfills.bundle.js:16417:40)
    at scheduleResolveOrReject (http://localhost:3000/polyfills.bundle.js:16727:15)
    at ZoneAwarePromise.then (http://localhost:3000/polyfills.bundle.js:16805:18)
    at new ApplicationInitStatus (http://localhost:3000/vendor.bundle.js:27227:60)
    at NgModuleInjector.AppModuleInjector.createInternal (AppModule.ngfactory.js:390:36)
    at NgModuleInjector.create (http://localhost:3000/vendor.bundle.js:41694:76)BrowserDomAdapter.logError @ browser_adapter.js:84ExceptionHandler.call @ exception_handler.js:68next @ application_ref.js:348schedulerFn @ async.js:89SafeSubscriber.__tryOrUnsub @ Subscriber.js:225SafeSubscriber.next @ Subscriber.js:174Subscriber._next @ Subscriber.js:124Subscriber.next @ Subscriber.js:88Subject._finalNext @ Subject.js:128Subject._next @ Subject.js:120Subject.next @ Subject.js:77EventEmitter.emit @ async.js:77onError @ ng_zone.js:124onHandleError @ ng_zone_impl.js:74ZoneDelegate.handleError @ zone.js:336Zone.runTask @ zone.js:268ZoneTask.invoke @ zone.js:433
Subscriber.js:229 Uncaught ObjectUnsubscribedError

line that occurs an error

  dismiss() {
    const _dismiss = () => {
      this.destroy();
      **this._resultDeferred.reject();**
    };
    this._fireHook<boolean>('beforeDismiss')
      .then(value => value !== true && _dismiss())
      .catch(_dismiss);
  }
andyrue commented 8 years ago

I'm experiencing this as well. I just updated from beta.10 to beta.12 and now receive this error when clicking "Yes" or "No" to close a modal. Using rc.6 using Vex.

shlomiassaf commented 8 years ago

@orange4glace There are 2 different issues.

The issue when you get an error when the modal is dismissed (backdrop click or X close button) is a duplicate of #188 (you opened first but the discussion is held there)

The first issue you describe when resolving the modal is something I'm not able to reproduce, it works fine for me. My guess is that it's related to animations, you either forgot to add the CSS for VEX or removing some elements before animations is done.

Please re-open an issue with more details about your 1st issue.