Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Can't change dynamically eventData from a Draggable #914

Open
Valink opened this issue Sep 20, 2022 · 0 comments
Open

Can't change dynamically eventData from a Draggable #914

Valink opened this issue Sep 20, 2022 · 0 comments

Comments

@Valink
Copy link

Valink commented Sep 20, 2022

Hi,
first many thanks for this awesome helper to integrate fullcalendar easily to svelte.

Here is my issue :
I can't modify dynamically eventData from a Draggable like I would do for other Svelte component. In others words, when I change pricedEventTitle input value, I would like the next time I drap/drop the Draggable in calendar it would take this new value as a title.

image

Here is a simplified code of what I have :

<script>
  let pricedEventTitle = 0;

  $: pricedEventData = {
    title: pricedEventTitle,
  };
</script>

<input bind:value={pricedEventTitle}></input>

<p>{pricedEventData.title}</p> <!-- The value is changing like expected -->

<Draggable eventData={pricedEventData}> <!-- So the object values passed is correct -->
  <span>{pricedEventTitle}</span>
</Draggable>

However, as far as I understand (not sure) in Draggable.svelte, the eventData is only set at Draggable initialisation.
How would you proceed for this use case ?

  • Do EventData modification should propagate ?
  • Or may I handle manually this by destructing and recreating the Draggable at each Draggable modification ? Like this (it's working well though):
{#key pricedEventTitle}
  <Draggable eventData={pricedEventData}>
    <span>{pricedEventTitle}</span>
  </Draggable>
{/key}

Cheers,
Valink

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant