vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.74k stars 26.62k forks source link

Use createPaginationContainer cause to look for an un-existing query #67614

Closed stalinb87 closed 1 month ago

stalinb87 commented 2 months ago

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/7tc9th?file=%2F.codesandbox%2Ftasks.json

To Reproduce

  1. Setup a next js application using relay js
  2. Create a component using the createPaginationContainer
  3. Navigate to a page using that component

Current vs. Expected behavior

Current Behavior

It fails to load because is trying to look for a query that doesn't exist it always looks for to.graphql.js

image

Expected behavior

It should load the page without error

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 14.2.4 // Latest available version is detected (14.2.4).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

SWC

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local)

Additional context

The relay compiler seems to be ok with this; if I run pnpm relay-compiler, it works fine

kdy1 commented 1 month ago

It looks like an issue of regex for capturing the operation name.

Workaround would be removing query to in the comment.

# Pagination query to be fetched upon calling 'loadMore'.
kdy1 commented 1 month ago

https://github.com/swc-project/plugins/pull/333 should fix this

stalinb87 commented 1 month ago

That was it, I removed the comment, and it is working, thanks

kdy1 commented 1 month ago

I'll close this once it's properly fixed

github-actions[bot] commented 2 weeks ago

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.