Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding to DOM causes endless requests #7

Open
MCKLtech opened this issue Dec 2, 2022 · 1 comment
Open

Adding to DOM causes endless requests #7

MCKLtech opened this issue Dec 2, 2022 · 1 comment

Comments

@MCKLtech
Copy link

MCKLtech commented Dec 2, 2022

I've encountered an odd error. When I add the tagify code, it seems to cause endless requests (As if the DOM is being constantly updated)

<div wire:ignore>
                    <input data-pharaonic="tagify"
                           data-component-id="{{$this->id}}"
                           wire:model="state.group"
                           data-suggest-list='{{json_encode(collect($groups)->pluck('name')->unique())}}'
                           data-suggest
                           data-direct
                           class="min-w-full bg-white shadow block border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm"
                           placeholder="{{__('Type here to enter a new group.')}}"
                    >
                </div>

Removing the code stops the requests. It seems to be endlessly updating the state.group:

updates
: 
[{type: "callMethod", payload: {id: "3kbg", method: "$set",…}}]
0
: 
{type: "callMethod", payload: {id: "3kbg", method: "$set",…}}
payload
: 
{id: "3kbg", method: "$set",…}
id
: 
"3kbg"
method
: 
"$set"
params
: 
["state.group", ["Team A", "Team B",…]]
0
: 
"state.group"
1
: 
["Team A", "Team B",…]
type
: 
"callMethod"

Edit: Removing all items from the field stops the requests. So it seems like if any values in set, it will just continually make HTTP calls.

@MCKLtech
Copy link
Author

MCKLtech commented Dec 2, 2022

Setting wire:model.defer appears to fix this:

<div wire:ignore>
                    <input data-pharaonic="tagify"
                           data-component-id="{{$this->id}}"
                           **wire:model.defer="state.group"**
                           data-suggest-list='{{json_encode(collect($groups)->pluck('name')->unique())}}'
                           data-suggest
                           data-direct
                           class="min-w-full bg-white shadow block border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm"
                           placeholder="{{__('Type here to enter a new group.')}}"
                    >
                </div>

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

No branches or pull requests

1 participant