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

Sending a non-serializable modal context causes obtuse error message #10

Open
Blackbaud-ChristiSchneider opened this issue Nov 9, 2018 · 0 comments

Comments

@Blackbaud-ChristiSchneider

I think the scope of this fix should just be to supply a useful error message such as "Non-serializable modal context not supported".

If I attempt to pass a function to the modal context, I get the error: DOMException: Failed to execute 'postMessage' on 'Window': function () { } could not be cloned.

Example code:

import { Component, Injectable } from '@angular/core';
import { SkyAppConfig } from '@skyux/config';
import { SkyAddinModalService } from '@blackbaud-internal/skyux-lib-addin-host';
import { AddinCloseModalArgs } from '@blackbaud-internal/sky-addin-host';
import { Router } from '@angular/router';

@Component({
  selector: 'example',
  templateUrl: './example.component.html'
})
@Injectable()
export class ExampleComponent {

  constructor(
    private skyAppConfig: SkyAppConfig,
    private skyAddinModalService: SkyAddinModalService,
    private router: Router
  ) { }

  public openExampleModal() {

    this.skyAddinModalService.openModal({
      id: 'Example Modal',
      url:
        `https://renxt.blackbaud.com/addins/addconstituent?envid=${this.skyAppConfig.runtime.params.get('envid')}&internalmodal=true`,
      modalMetadata: {
        context: {
          duplicateSelectedHandler: function () { }
        }
      }
    })
    .then((args: AddinCloseModalArgs) => {
      console.log(JSON.stringify(args));
    });
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant