Skip to content

[Bug]: Loop when using setOption for property slotMaxTime onDatesSet #121

@lukacavic

Description

@lukacavic

What happened?

Hello,
I have strange problem. In method onDatesSet I call setOption for slotMinTime and slotMaxTime to show min and max working time for resource.
slotMinTime is working ok, but slotMaxTime is giving loop, infinite requests are triggered (looking Laravel Debugbar).
This is code:

protected function onDatesSet(DatesSetInfo $info): void
    {
        $workingTimes = $this->getEarliestWorkingStartForDate($info->start);

        $this->setOption('slotMinTime', $workingTimes['min']);
        $this->setOption('slotMaxTime', $workingTimes['max']);
    }

Passed value is string like: '06:00' or '22:00'. I also tried another formats like stated in vkurko/calendar like: '22:00:00', or 22 as int. If I pass null, requests are not triggered.
I also tried another properties, no requests, only problem with slotMaxTime.

Check image bellow and number of requests.

Or check video: https://drive.google.com/file/d/1zT-sL_o0l9YPLtyokS3ZUBhTv8ALH4ZW/view?usp=drive_link

Image

How to reproduce the bug

use setOption for slotMaxTime in "onDatesSet" method

Package Version

2.0.2

PHP Version

8.2.0

Laravel Version

12, latest

Which operating systems does with happen with?

macOS

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions