justpy-org / justpy

An object oriented high-level Python Web Framework that requires no frontend programming
https://justpy.io
Apache License 2.0
1.22k stars 96 forks source link

transition_test.py transition enter not always working as it is supposed to #602

Closed byzakyz closed 2 years ago

byzakyz commented 2 years ago

A_animated

examples/tutorial/transitions/transition_test.py

transition enter is not always working as it is supposed to, it only started working after second try in this example gif. I tired it out a bunch of times and its not working half of the time randomly.

tholzheim commented 2 years ago

The issue was the transitionFunction in html_components.js https://github.com/justpy-org/justpy/blob/cb3511b2cf21a706a92672aeb23dbfa6d31b301a/justpy/templates/js/vue/html_component.js#L191-L201

The timeout was too low, so that the transition was sometimes not loaded because the transition class was removed before the element was registered as transition element.

We fixed it by increasing the timeout to 30ms.

The complete transition handling needs a refactoring as it is currently suboptimal