Comments (3)
Slightly more context: it looks like calling reject()
without a reason is supported when the promise is on the client side - see https://react.dev/reference/react/use#dealing-with-rejected-promises
I'm guessing that this may be something to do with how Flight deals with promise resolution.
from next.js.
.catch(e=>{
return "no new message found.";
});Maybe you need to throw a catch to catch him
from next.js.
.catch(e=>{ return "no new message found."; });Maybe you need to throw a catch to catch him
Yes, you can write that code, but it's non-obvious that you need to, and if the Promise that rejects is not in your own codebase then it may be difficult/impossible to do that. Also, it's not going to trigger your error boundary, so now you have 2 code paths to handle errors.
I think this is a bug as it doesn't seem reasonable that rejecting a promise without an argument (which is a valid use of reject()
) should crash the process and halt the response. There are workarounds - the catch you mention and also passing an Error instance to reject() (you can even just call reject({digest: 'something'})
as it's the .digest
property the code is looking for), but I lost of few hours of my life figuring this out and I can see it affecting others too.
from next.js.
Related Issues (20)
- Modal stays there even when navigating away HOT 1
- Docker standalone build is not working when adding layout to /app path HOT 1
- Next.js project in an npm workspace has broken standalone build
- devIndicators `buildActivityPosition` option doesn't work HOT 3
- Rewrites are in conflict with i18n HOT 3
- Build fails when calling `after` in server action HOT 1
- Instrumentation files not included in standalone output HOT 1
- NextJS /app router waits for server response before showing 'loading.tsx' HOT 3
- Scroll restoration does not work with pages router. HOT 1
- Incorrect typing of `ProcessEnv` HOT 1
- eslint-plugin-next → fast-glob only matching files HOT 8
- Strange multi-zone pattern(奇怪的多区域模式) HOT 2
- node:buffer error HOT 1
- Docker example does not work HOT 1
- Problem with tailwindcss HOT 2
- Cannot deploy my next.js app to vercel HOT 2
- [TurboPack] No Media Queries breakpoints in Chrome Device Emulation mode HOT 1
- request dynamic page with header `x-now-route-matches` will create SSG cache and break the page HOT 2
- Docs: HOT 1
- Failed to complie and load Server, SyntaxError: Invalid regular expression HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.