Why my code doesn't work every time I press the button

I made a code that filters my list_viewer when I press the button. But it only filters properly after second press as you can see. The number shows how many items should be shown.
https://drive.google.com/open?id=1fY_XfVYc2HFU qZoa3GgXTvAz351QkDvn
https://drive.google.com/open?id=1fY_XfVYc2HFUqZoa3GgXTvAz351QkDvn