Skip to content

[2.60.0] Broken reactivity after Requested refresh was rejected because it exceeded requested limit #15906

@henrykrinkle01

Description

@henrykrinkle01

Describe the bug

This completely breaks my page. It used to work in 2.59.1. I found this happen in 2 routes, could be more. In the first route (this reproduction), I can work around the issue. However, in the second route it happens randomly after several consecutive form submissions and I haven't been able to reproduce it yet.

Increasing the requested limit from 1 to 2 seems to fix it but I don't consider this a proper workaround.

Reproduction

const items = [
  { id: 1, status: 'foo', name: 'item 1' },
  { id: 2, status: 'bar', name: 'item 2' },
  { id: 3, status: 'foo', name: 'item 3' },
  { id: 4, status: 'bar', name: 'item 4' },
];
export const getStatusList = query(() => {
  return [
    { id: 1, name: 'foo', count: 2 },
    { id: 2, name: 'bar', count: 2 },
  ];
});

export const getItemList = query(z.string(), (status) => {
  return items.filter((i) => i.status === status);
});

export const cmd_refresh = command(async () => {
  console.log('refreshing');
  await requested(getStatusList, 1).refreshAll();
  await requested(getItemList, 1).refreshAll();
});
<script lang="ts">
	import { page } from '$app/state';
	import { cmd_refresh, getItemList, getStatusList } from './test.remote';

	const selectedStatus = $derived(page.url.searchParams.get('status') ?? 'foo');
	const statusList = $derived(await getStatusList());
	const itemList = $derived(await getItemList(selectedStatus));
</script>

Reproduction steps:
<ol>
	<li>Click "bar"</li>
	<li>Click "foo" twice</li>
</ol>
<h2>Status select</h2>
<ol>
	{#each statusList as status (status.id)}
		<li>
			<a
				href="/?status={status.name}"
				onclick={() => {
					if (selectedStatus === status.name) {
						//this is fine
						//getStatusList().refresh();
						//getItemList(selectedStatus).refresh();

						//this is not
						cmd_refresh().updates(getStatusList, getItemList);
					}
				}}
			>
				{status.name}
			</a>
		</li>
	{/each}
</ol>
<h2>Item list</h2>
<ul>
	{#each itemList as item (item.id)}
		<li>{item.name}</li>
	{/each}
</ul>

https://stackblitz.com/edit/sveltejs-kit-template-default-h5wvuaby?file=src%2Froutes%2F%2Bpage.svelte,src%2Froutes%2Ftest.remote.ts

Logs

System Info

svelte@5.55.9
kit@2.60.1

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions