flet icon indicating copy to clipboard operation
flet copied to clipboard

Fix Assertion Error on Page.update()

Open HappyCoder256 opened this issue 1 year ago • 5 comments

Duplicate Check

  • [x] I have searched the opened issues and there are no duplicates

Describe the bug

Everytime am trying to update my ui through different threads, i run into the same error it doesn't matter which control, all of them do the same thing especially in this latest flet version 0.27.1

Code sample

Code
[Paste your code here]

To reproduce

File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\page.py", line 732, in update r = self.__update(self) File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\page.py", line 798, in __update commands, added_controls, removed_controls = self.__prepare_update(*controls) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\page.py", line 814, in __prepare_update control.build_update_commands( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self._index, commands, added_controls, removed_controls ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\control.py", line 480, in build_update_commands ctrl.build_update_commands( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ index, ^^^^^^ ...<3 lines>... isolated=ctrl.is_isolated(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\control.py", line 480, in build_update_commands ctrl.build_update_commands( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ index, ^^^^^^ ...<3 lines>... isolated=ctrl.is_isolated(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\control.py", line 496, in build_update_commands assert self.__uid is not None ^^^^^^^^^^^^^^^^^^^^^^ AssertionError

Expected behavior

No response

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

Windows 10

Flet version

0.27.1

Regression

No, it isn't

Suggestions

No response

Logs

future: Traceback (most recent call last): File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\concurrent\futures\thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\page.py", line 903, in wrapper handler(*args) ~~~~~~~^^^^^^^ File "e:\MY PROJECT APK\Mn p\fletMovieDesign2-master\fletters\main.py", line 4206, in toggle_content page.update() ~~~~~~~~~~~^^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\page.py", line 732, in update r = self.__update(self) File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\page.py", line 798, in __update commands, added_controls, removed_controls = self.__prepare_update(*controls) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\page.py", line 814, in __prepare_update control.build_update_commands( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self._index, commands, added_controls, removed_controls ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\control.py", line 480, in build_update_commands ctrl.build_update_commands( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ index, ^^^^^^ ...<3 lines>... isolated=ctrl.is_isolated(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\control.py", line 480, in build_update_commands ctrl.build_update_commands( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ index, ^^^^^^ ...<3 lines>... isolated=ctrl.is_isolated(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Jovanne\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\core\control.py", line 496, in build_update_commands assert self.__uid is not None ^^^^^^^^^^^^^^^^^^^^^^ AssertionError

Additional details

No response

HappyCoder256 avatar Mar 09 '25 22:03 HappyCoder256

Please share repro code.

ndonkoHenri avatar Mar 10 '25 10:03 ndonkoHenri

A similar error occurred to me: ERROR - AssertionError: _process_remove_command: control with ID '_6690' not found. It was captured by my logger. As far as I understand, this happens when the user navigates to another route. I didn't encounter such errors on version 0.24.1, for example. Just FYI.

Katsiuk avatar Mar 15 '25 02:03 Katsiuk

Will be nice if you could comeup with some code repro of the issue.

ndonkoHenri avatar Mar 15 '25 11:03 ndonkoHenri

I'm not sure if you'll be able to reproduce it on the first try, it happens from time to time. My code is too complex to provide and has some confidential data. @HappyCoder256, maybe you can provide some code to reproduce this issue?

Katsiuk avatar Mar 16 '25 03:03 Katsiuk

Let me create a sample to reproduce that

HappyCoder256 avatar Mar 18 '25 05:03 HappyCoder256