TIOvOIT / praecox-datepicker

A date picker built with Svelte.Simple and flexible, supporting functions such as single selection, multiple selection, disabling, and marking.
MIT License
65 stars 13 forks source link

Updating selected prop doesn't re-render #34

Open homostellaris opened 2 years ago

homostellaris commented 2 years ago

Can't provide a code example right now but just want to check this is supported?

mharis commented 1 year ago

Yep. Can confirm.

mharis commented 1 year ago

Use #key to force re-render of the component

A quick example would be:

{#if showDatePicker}
<div class="datepicker-container-calendar" on:click={() => datePickerViewer()} on:keypress={() => datePickerViewer()} >
{#key dateSelected}
<Datepicker
    {...setting.properties}
    pickerRule='single'
    viewDate={setting.value || new Date()}
    bind:selected={dateSelected}
    bind:pickerDone={datePickerDone}
/>
{/key}
</div>
{/if}