Skip to content

[AGAIN] Incorrect error message "... received an unexpected slot "default".Β #6325

@YamiOdymel

Description

@YamiOdymel

Describe the bug

received an unexpected slot "XXXXXX" for all the slots which were used in the component.

Logs

index.mjs:1701 <ts-divider> received an unexpected slot "default".

To Reproduce

<div class="ts-divider">
    <!-- Text -->
    {#if $$slots.default}
    <div class="ts-divider__text">
        <div class="ts-divider__text__start">
            <div class="ts-divider__text__line"></div>
        </div>
        <div class="ts-divider__text__center">
            <slot></slot>
        </div>
        <div class="ts-divider__text__end">
            <div class="ts-divider__text__line"></div>
        </div>
    </div>
    {/if}
    <!-- / Text -->

    <!-- Line Only -->
    {#if !$$slots.default}
    <div class="ts-divider__line"></div>
    {/if}
    <!-- / Line Only -->
</div>

Expected behavior

No warning message should appeared.

Stacktraces
If you have a stack trace to include, we recommend putting inside a <details> block for the sake of the thread's readability:

index.mjs:1701 <ts-divider> received an unexpected slot "default".
validate_slots @ index.mjs:1701
instance       @ Divider.svelte:132
init           @ index.mjs:1517
Divider        @ Divider.svelte:18
(anonymous)    @ Divider.svelte:18
(anonymous)    @ Divider.svelte:18

Information about your Svelte project:

  • Your browser and the version: (e.x. Chrome 52.1, Firefox 48.0, IE 10): Chrome 90

  • Your operating system: (e.x. OS X 10, Ubuntu Linux 19.10, Windows XP, etc): Ubuntu 19.10

  • Svelte version (Please check you can reproduce the issue with the latest release!): ^3.38.1

  • Whether your project uses Webpack or Rollup: Rollup

Severity

It's not immediate just annoying warning messages.

Additional context

Re-open an new issue from Incorrect error message "... received an unexpected slot "default". #4546

Metadata

Metadata

Assignees

No one assigned

    Labels

    popularmore than 20 upthumbs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions