Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

y-m's avatar
Level 1

How to avoid Errors while using polling when I deploy

Hello, I would like to know about error avoidance during polling when I deploy.

I use polling.

When deploying code with the variable $hoge added, if the screen is displayed without reloading, the function will be executed by polling and an "Undefined array key “hoge”" error will be displayed. Because the deployment is done while the user is using it I'm thinking about how to automatically reload the screen when changes are made.

I want to avoid the way to detect the event when this change is made or the error itself.

I would like to know if there is a way.

Sample.php

class Sample extends Component
{

    public $hoge; // add and deploy

    public function mount()
    {
       $this->hoge = "World"; // add and deploy
    }

    /**
     * view
     */
    public function render()
    {
        return view('livewire.sample');
    }
}

sample.blade.php

<div wire:poll.1000ms>
   <p>{{ now() }}</p>
   <p>{{ $hoge }}</p> {{-- add and deploy --}}
</div>
0 likes
1 reply
Snapey's avatar

put the application in maintenance mode during deployment -- or did I misunderstand the question?

Please or to participate in this conversation.