[question] whats the best way to handle failed imports?
See original GitHub issueProbably a dumb question but really curious what the best way is to handle if an import like the one below fails. Could be because that remote is down or just a generic error.
If we go with the example below, I’ve noticed that if main
is down (for example, I don’t start the dev server), then the GET
request that wants to get ExposedLayout
just hangs and doesn’t resolve at all.
const Layout = dynamic(
() => {
const mod = import('main/ExposedLayout');
return mod;
},
{ ssr: false },
);
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Handle import errors - Analytics Help - Google Support
There are several basic reasons why Data Import might not be working for you: Not reporting on the right view. Not using the...
Read more >What is the best practice for dealing with a failed dynamic ...
Please be sure to answer the question. Provide details and share your research! ... Asking for help, clarification, or responding to other answers ......
Read more >Review and troubleshoot import errors
Below, learn how to resolve errors detected during an import, download an error file, view error details, and correct issues in your import...
Read more >Skipping over failed imports until they are needed (if ever)
There is one issue with your approach which is, in the case of multiple import failure, only the last one can be properly...
Read more >Solutions to common product CSV import problems
Troubleshooting product CSV files. Identify missing fields or headers, illegal formatting or identifier duplications before contacting support.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yeah i usually to import().catch(import(npm))
in future ill introduce delegate modules which will offer more power
I started with an error boundary too, but only had a stack trace rendered to the page. I could prevent that by adding a
catch
to theimport
call. The error would be logged to the console for easier debugging, and then I could display some fallback UI.I haven’t tried it, but the fallback component could theoretically be the same fallback component you use in your error boundary.