Skip to content

Inconsistencies with exclude_internal_props ($-prefixed props disappear, $$slots and $$scope bleed through to initial mount)Β #9129

@SystemParadox

Description

@SystemParadox

Describe the bug

If you use $$props (or $$restProps) in a reactive statement/block then svelte uses exclude_internal_props to exclude internal stuff like $$slots and $$scope. However, there are two issues with this:

  1. This only seems to apply to updates, on the initial mount $$props includes everything.
  2. If the application tries to use a prop name like $x then the prop doesn't show up in $$props and $$restProps (except on the initial mount).

Ideally it would seem that svelte should be passing internal stuff around as a separate argument so that it's not mixed with the props in the first place. That would avoid having to run this exclude at all, which would fix this confusion and might help with some of the performance implications of using $$props?

Reproduction

Please see https://svelte.dev/repl/42b1cdf4da0243c19d43d6910cc7017b?version=4.2.0.

Notice that initialProps includes $x, $$slots and $$scope, but updatedProps and a direct render of $$props is empty.

Logs

N/A (see REPL).

System Info

N/A. See REPL example. Tested with version=3.55.1 and version=4.2.0 (same results).

Severity

annoyance

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