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

prevent "loading" is ignored by next/dynamic because you have enabled "suspense" warning, when loading is undefined #41630

Closed
wants to merge 2 commits into from

Conversation

hacknlove
Copy link

fixes #40388

This issue is marked as fixed, but unless I set specifically loading: null I am still getting the warning

"loading" is ignored by next/dynamic because you have enabled "suspense". Place your loading element in your suspense boundary's "fallback" prop instead. Read more: https://nextjs.org/docs/messages/invalid-dynamic-suspense

Not set any loading, (so loading is undefined) should not cause this warning.

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have a helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have a helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running pnpm lint
  • The "examples guidelines" are followed from our contributing doc

@@ -131,7 +131,7 @@ export default function dynamic<P = {}>(
)
}

if (loadableOptions.loading != null) {
if (loadableOptions.loading != null && loadableOptions.loading !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I see what's going on.

We are setting a default loadableOptions.loading so when the user enables the suspense mode we need to unset the default.

It's not a critical bug, but developer experience matters, and people freak out with warnings with unknown origin.

I have updated the PR.
I should have given it a more profound look, in the first place, instead of wasting your time.

Thanks for your revision.

@hacknlove hacknlove closed this Oct 24, 2022
@hacknlove hacknlove reopened this Oct 24, 2022
unset the default loading option when suspense is enabled
@hacknlove hacknlove closed this Nov 28, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incorrect warning: "loading" is ignored by next/dynamic because you have enabled "suspense".
3 participants