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

Layout should have a provision to handle application loading errors gracefully #49

Closed
tsukhu opened this issue Jun 16, 2020 · 4 comments

Comments

@tsukhu
Copy link
Contributor

tsukhu commented Jun 16, 2020

Please refer to issue #47 where if there is a loading failure we continue to see the loader and the user will not know if there is a failure.

The layout engine should have some provision to show an alternate message or alternate error handling component plus also unload the js file for the failing application.

@joeldenning
Copy link
Member

joeldenning commented Jun 16, 2020

Agreed. Perhaps a load-error attribute on <application> elements would be the right way to do this? What do you think of the following API:

<application name="nav" loader="navLoader" load-error="navLoadError"></application>
import { constructRoutes } from 'single-spa-layout';

const routes = constructRoutes(document.querySelector('#single-spa-layout'), {
  loaders: {
    navLoader: "<img src="loading.gif"></img>",
  },
  loadErrors: {
    navLoadError: "<div>The navbar is having problems</div>"
  }
})

One question about this is if we should also think about mount errors for applications as part of this. @TheMcMurder do you have thoughts on this?

@tsukhu
Copy link
Contributor Author

tsukhu commented Jun 17, 2020

One thought was can we look esi spec for ideas
https://www.w3.org/TR/esi-lang/

Namely onerror=continue and the try|attempt|except constructs

@tsukhu
Copy link
Contributor Author

tsukhu commented Jun 17, 2020

Another possibility is the application tag is likely to become very verbose with leaders, errors , parameter lists etc. and its likely we add more in the times to come.

Since we already have the json being provided in the constructRoute Api we can probably only provide the name and the rest including the params ,loaders , exception paths are defined in json. This will avoid the clutter as we as keep the template stable for the users.

@joeldenning
Copy link
Member

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

2 participants