Skip to content

Binding export const props broke with Svelte 3.54 #8179

Closed as not planned
Closed as not planned
@GauBen

Description

@GauBen

Describe the bug

I use export const to expose component methods and Svelte's behavior changed with the 3.54 release (probably because of Prevent running init binding unnecessarily).

It looks roughly like this:

Parent.svelte:

<script>
  let closeModal = () => {}
</script>

<Modal bind:closeModal />

<!-- Since Svelte 3.54, clicking this button does nothing -->
<button on:click={closeModal}>close</button>

Modal.svelte

<script>
  export const closeModal = () => { /* ... */ }
</script>

It used to work with Svelte <= 3.53.1.

I'm not sure if this is the best way to implement this kind of behavior, any advice would be welcome.


Related: #8168
Suspected breaking change: (edited) #7981

Reproduction

Logs

No response

System Info

-

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