Skip to content

Commit

Permalink
prevent requests on close
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev committed Oct 9, 2023
1 parent 989c9cf commit 29211fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/powergrid.js": "/powergrid.js?id=b21468b1ec2644107e4368cefcfab9b7",
"/powergrid.js": "/powergrid.js?id=a0371b52d5e7ae62583a68086cea84b6",
"/tom-select.css": "/tom-select.css?id=7af730d2c4bf937316d4002948b1571d",
"/powergrid.css": "/powergrid.css?id=f2c32aef475db76375ad76fb2f0f7d33"
}
2 changes: 1 addition & 1 deletion dist/powergrid.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions resources/js/components/pg-flatpickr.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default (params) => ({
customConfig: params.customConfig ?? null,
type: params.type,
element: null,
selectedDates: null,
init() {
window.addEventListener(`pg:clear_flatpickr::${this.tableName}:${this.dataField}`, () => {
if (this.$refs.rangeInput && this.element) {
Expand All @@ -32,8 +33,9 @@ export default (params) => ({
if(this.$refs.rangeInput) {
this.element = flatpickr(this.$refs.rangeInput, options);

const selectedDates = this.$wire.get(`filters.${this.type}.${this.dataField}.formatted`)
this.element.setDate(selectedDates)
this.selectedDates = this.$wire.get(`filters.${this.type}.${this.dataField}.formatted`)

this.element.setDate(this.selectedDates)
}
},
getOptions() {
Expand All @@ -60,7 +62,7 @@ export default (params) => ({

selectedDates = selectedDates.map((date) => this.element.formatDate(date, 'Y-m-d'));

if (selectedDates.length > 0) {
if (selectedDates.length > 0 && (this.selectedDates !== dateStr)) {
Livewire.dispatch('pg:datePicker-' + this.tableName, {
selectedDates: selectedDates,
dateStr,
Expand Down

0 comments on commit 29211fc

Please sign in to comment.