Skip to content

Add possibility to set svelte:boundary pending prop to null #18166

@vladshcherbin

Description

@vladshcherbin

Describe the problem

Quite common navigation pattern this days: non-blocking on client and blocking on server. To achieve this here's Rich suggested example:

{#snippet pending()}
  <div class="skeleton">...</div>
{/snippet}

<svelte:boundary pending={browser ? pending : null}>
  <div class="content">...</div>
</svelte:boundary>

This will result in a warning due to pending type - Snippet or undefined.

This works but doesn't look as nice:

<svelte:boundary pending={browser ? pending : undefined}>
  <div class="content">...</div>
</svelte:boundary>

Additionally it also gives eslint no-undefined error for me.

Describe the proposed solution

Would be awesome to be able to pass null to pending prop, working same as passing undefined:

<svelte:boundary pending={null}>...</svelte:boundary>

Importance

would make my life easier

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