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

Why if reopen the model which I added several minutes ago the model is blocked ? #2

Open
sergeynilov opened this issue Nov 17, 2024 · 2 comments

Comments

@sergeynilov
Copy link

In Laravel 10 / nova 4.27 app I added "mateusz-peczkowski/nova-heartbeat-resource-field": "^1.0"
and added in resource :

            Tabs::make(__('Product'), [
                Tab::make(__('Product details'), [
                    ID::make()->sortable()->readonly(),
                    Hidden::make('user_id')->default(LoggedUserFacade::getLoggedUserId()),
                    NovaHeartbeatResourceField::make('Heartbeat')
                        ->resourceId($this->id)->allowRetake(),

                    Hidden::make('sku')->default(Str::orderedUuid()),

This plugin works ok, but I found that if reopen the model which I added several minutes ago(under the same account) the model is blocked :

https://prnt.sc/1aFC0BXrrKP9

That is not correct. Can it be fixed ?

@mateusz-peczkowski
Copy link
Owner

mateusz-peczkowski commented Dec 18, 2024

Hello,

I apologize for the delayed response. I did not receive a GitHub notification regarding your issue.

It appears that you have not implemented the recommended action, which is to clear expired heartbeats. To do this, you can use the following code:

$schedule->command('heartbeat:clear-expired')->everyMinute();

In your case, the beacon that you have created is not „expiring.” This is why you need to schedule this command and use cron to ensure that it runs regularly.

Normally, the beacon should be cleared when you leave the resource editing mode. However, it will not be cleared when you close the tab or browser while editing, as this would prevent package from catching your changes (it clears beacons on detail and index views and on leave via vue). Therefore, it is necessary to use the „clear-expired” command to ensure that the beacon is cleared when you leave the editing mode via tab close or browser.

Hope it helps you :)

@mateusz-peczkowski
Copy link
Owner

Btw. I saw on your screenshot that your avatar is different (heartbeat vs top right corner) ;) You can publish the config file:

php artisan vendor:publish --provider="MateuszPeczkowski\NovaHeartbeatResourceField\HeartbeatResourceServiceProvider"

And then update heartbeat_avatar_url to match yours :)

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

2 participants