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

[BUG] Using defer, Expected a Response to be returned from queryRoute #8714

Closed
wants to merge 2 commits into from
Closed

Conversation

Mause
Copy link

@Mause Mause commented Feb 8, 2024

I hope this method of reporting a bug is correct? This looks related to #4741 but not identical, and feels like a really basic case, so I'm not sure what's going wrong here

When running the submitted test, I get:

The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new
Error: Expected a Response to be returned from queryRoute
    at Object.invariant [as default] (/home/me/remix/build/node_modules/@remix-run/server-runtime/dist/invariant.js:18:11)
    at handleResourceRequestRR (/home/me/remix/build/node_modules/@remix-run/server-runtime/dist/server.js:297:25)
    at requestHandler (/home/me/remix/build/node_modules/@remix-run/server-runtime/dist/server.js:103:18)
    at file:///home/me/remix/integration/bug-report-test.ts:116:18
    at /home/me/remix/node_modules/@playwright/test/lib/worker/workerMain.js:351:9
    at TestInfoImpl._runAndFailOnError (/home/me/remix/node_modules/@playwright/test/lib/worker/testInfo.js:156:7)
    at /home/me/remix/node_modules/@playwright/test/lib/worker/workerMain.js:347:7
    at TimeoutRunner.run (/home/me/remix/node_modules/playwright-core/lib/utils/timeoutRunner.js:46:14)
    at TimeoutManager.runWithTimeout (/home/me/remix/node_modules/@playwright/test/lib/worker/timeoutManager.js:62:7)
    at TestInfoImpl._runWithTimeout (/home/me/remix/node_modules/@playwright/test/lib/worker/testInfo.js:143:26)
    at WorkerMain._runTest (/home/me/remix/node_modules/@playwright/test/lib/worker/workerMain.js:285:5)
    at WorkerMain.runTestGroup (/home/me/remix/node_modules/@playwright/test/lib/worker/workerMain.js:209:11)
    at process.<anonymous> (/home/me/remix/node_modules/@playwright/test/lib/common/process.js:88:22)

Copy link

changeset-bot bot commented Feb 8, 2024

⚠️ No Changeset found

Latest commit: 935fff0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 8, 2024

Hi @Mause,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 8, 2024

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

});
};

export function Deferred() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs a default export to be treated as a UI route. Without it, it's being treated as a resource route which doesn't support defer

Suggested change
export function Deferred() {
export default function Deferred() {

@brophdawg11
Copy link
Contributor

This looks like just a missing default export - with that added the deferred data is working correctly: https://stackblitz.com/edit/remix-run-remix-gkedbv?file=app%2Froutes%2F_index.tsx

@brophdawg11 brophdawg11 closed this Feb 8, 2024
@Mause
Copy link
Author

Mause commented Feb 9, 2024

This looks like just a missing default export - with that added the deferred data is working correctly: https://stackblitz.com/edit/remix-run-remix-gkedbv?file=app%2Froutes%2F_index.tsx

Ah, thanks for the pointer, figured I'd made a silly mistake somewhere. Might be worth revisiting the error message though?

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

Successfully merging this pull request may close these issues.

2 participants