sveltejs / sveltejs/kit

Remote functions break when the name of the file containing the function doesn't have the `.` before the `remote.js` part

Open
#14,930 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

Example for the form() function: When I create a file, that contains a form() remote function, and I name the file simply remote.js, the action attribute on the form element using this remote function is not going to be populated.

The query() functions only work after a reload, Then they fetch their data, but not with HMR.

However, I don't even need to put anything before the dot, e.g. .remote.js seems to work just fine.

Why do I want to be able to name the files just remote.js?

Most of the times, the folder name is already enough to differentiate. Usually, I create a folder for the feature (feature or vertically sliced architecture), and differentiate the contexts inside of the slice, e.g. with client.js and server.js files, and it works very well for me. Thanks to remote functions, the vertical slicing got much more powerful, and I can now put the data-loading bridge also into the feature-folder, which would be the remote.js file. I could live with naming the remote-function files .remote.js, if it really, really needs to have the . in the filename, but it feels semantically wrong (. for hidden files) and actually like this was not intended.

Reproduction

Put a form() remote function into a file named remote.js, and try to call it. You should get a 405. When inspecting the form element the action attribute should look like this: action="?/remote="

Put a query() remote function into a file named remote.js, and browse to the page, that fetches the data. The data is only shown after a full page reload.

Logs

System Info
System:
    OS: Linux 6.6 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 10.30 GB / 15.48 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 24.8.0 - /home/andreas/.nvm/versions/node/v24.8.0/bin/node
    npm: 11.6.2 - /home/andreas/.nvm/versions/node/v24.8.0/bin/npm
  Browsers:
    Chrome: 141.0.7390.107
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.0 => 7.0.0 
    @sveltejs/kit: ^2.47.1 => 2.48.5 
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1 
    svelte: ^5.41.0 => 5.43.7 
    vite: ^7.1.10 => 7.2.2
Severity

annoyance

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported reproduction using a remote function in a file named remote.js, checking both form() and query() behavior during navigation and HMR. Trace the remote-function filename handling and verify that the form action is populated and query data appears without a full reload.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, vite
Domain
full-stack
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.