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

Error when embedding a microfrontend in a view microfrontend #411

Open
danielwiehl opened this issue Feb 8, 2023 · 0 comments
Open

Error when embedding a microfrontend in a view microfrontend #411

danielwiehl opened this issue Feb 8, 2023 · 0 comments

Comments

@danielwiehl
Copy link
Collaborator

Describe the bug

When embedding a microfrontend in a microfrontend view and if the embedded microfrontend is not qualified to access the view capability, @scion/workbench-client of the embedded microfrontend reports the error Uncaught TypeError: Cannot read properties of undefined (reading 'metadata').

To Reproduce

Steps to reproduce the behavior:

  1. Provide private view capability in app 1
  2. Provide public microfrontend capability in app 2
  3. Declare an intention to microfrontend capability in app 1
  4. Add sci-router-outlet to the view microfrontend of app 1
  5. Navigate to the microfrontend capability in the sci-router-outlet, e.g. in the constructor of the view
  6. Open the view
  7. See the error logged to the console

Analysis

Since the workbench microfrontend integration propagates the view context to any nested level, the embedded microfrontend consequently constructs a view handle. However, the view capability lookup may fail if the microfrontend is not qualified to access the view capability, causing the reported error in ɵworkbench-view.ts#lookupViewCapabilityAndShareReplay.

Expected behavior

It should be revisited whether the view context should be exclusively available to the view microfrontend. Propagating the context hardly makes sense because the embedded microfrontend usually does not know its embedding context.

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

No branches or pull requests

1 participant