Skip to content

remote query without await #16477

Description

@hendrik-huels

Describe the bug

I don't know if this is intended, but it feels unintuitive.

This does not fetch:

<script lang="ts">
	import { getPosts } from './data.remote';

	const query = getPosts();
</script>

This does:

<script lang="ts">
	import { getPosts } from './data.remote';

	const query = getPosts();
	query.loading
</script>

It seems like you have to access loading, current or error to trigger the fetch of the RemoteQueryFunction.
I created a little repo to showcase how i try to preload stuff for a component.

I would assume, that calling getPosts() would already start fetching.

Reproduction

https://github.com/hendrik-huels/bug-or-feature

Logs

System Info

tested on "@sveltejs/kit": "^2.63.0" and "@sveltejs/kit": "3.0.0-next.11"

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions