Skip to content

[🐞] qwik-city doesn't check if server$ calls are server$ #7313

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

Open
wmertens opened this issue Feb 5, 2025 · 4 comments · May be fixed by #7441
Open

[🐞] qwik-city doesn't check if server$ calls are server$ #7313

wmertens opened this issue Feb 5, 2025 · 4 comments · May be fixed by #7441
Assignees
Labels
COMP: qwik-city TYPE: bug Something isn't working

Comments

@wmertens
Copy link
Member

wmertens commented Feb 5, 2025

Which component is affected?

Qwik City (routing)

Describe the bug

qwik-city should only allow calling server$ and other qrls if they are generated as server$.

Right now any valid qrl can be called. This is somewhat academic but still a concern.

@wmertens wmertens added COMP: qwik-city TYPE: bug Something isn't working labels Feb 5, 2025
@JerryWu1234
Copy link
Contributor

do it in optimizer ?
are there any more specific requirements if I want to do it ?

@JerryWu1234
Copy link
Contributor

JerryWu1234 commented Feb 25, 2025

https://discord.com/channels/@me/1295311135586652191/1341655795703742495

wmertenssaid:
hmmm

it means having to read the q-manifest file at startup and finding symbols that look like this:

 "s_0EBpKMD7Km0": {
      "origin": "../../qwik-router/lib/index.qwik.mjs",
      "displayName": "index.qwik.mjs_serverQrl_rpc",
      "canonicalFilename": "index.qwik.mjs_serverQrl_rpc_0EBpKMD7Km0",
      "hash": "0EBpKMD7Km0",
      "ctxKind": "function",
      "ctxName": "$",
      "captures": true,
      "parent": null,
      "loc": [
        53568,
        56525
      ]
    },

So the displayName ending with serverQrl_rpc and ctxKind function. And then in the place where it executes qFunc, check the list
and then the same for actions

this is context

@wmertens
Copy link
Member Author

By looking at the symbol name you can see if it's a server qrl, so no optimizer changes needed.

However, it would be great if the optimizer could list out the function argument names and captured scope names. Then we can generate an API report that should be checked in, which helps show when the API changes.

@maiieul
Copy link
Contributor

maiieul commented Mar 13, 2025

@JerryWu1234 I'm not sure I understand the issue (can't access your link), but I think you can do a first PR without the change for the optimizer; and create a separate issue for the optimizer optimization.

@JerryWu1234 JerryWu1234 linked a pull request Mar 20, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: qwik-city TYPE: bug Something isn't working
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

3 participants