rawilk / laravel-form-components

Form components built for Tailwind & Livewire.
https://randallwilk.dev/docs/laravel-form-components
MIT License
383 stars 41 forks source link

DatePicker error and rendering issues #124

Open gRoberts84 opened 1 year ago

gRoberts84 commented 1 year ago

Laravel Form Components Version

v8.1

Laravel Version

9.52.12

Alpine Version

3.12.3

Bug description

datePicker component loses reference to the input after initialisation.

Uncaught TypeError: Cannot convert undefined or null to object
    at slice (<anonymous>)
    at _flatpickr (index.js:1979:10)
    at flatpickr (index.js:2018:16)
    at date-picker.js:28:43
_flatpickr @ index.js:1979
flatpickr @ index.js:2018
(anonymous) @ date-picker.js:28

this.$refs.__input is populated when first rendering the page but when changing anything else on the page that causes a render, it becomes undefined and throws an error.

queueMicrotask(() => {
    this.__ready = true;

    this.__flatpickr = window.flatpickr(this.$refs.__input, this.__config());
});

It is also randomly showing the clear button when not active?

image

Steps to reproduce

Using the following:

<x-date-picker name="date" wire:model="date" :allow-input="false" format="d/m/Y" placeholder="dd/mm/yyyy" />

Relevant log output

No response

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.