-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix rendering issue #442
Merged
Merged
fix rendering issue #442
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, a raised `lona.errors.ClientError` was logged two times. Once by the view runtime, that received the error, and a second time by the general logging setup of Lona. The first log entry contained the JavaScript traceback, raised by the browser, the second log entry contained the full Python traceback from the server side. LonaWorker_0 ERROR 12:39:31.344648 lona.view_runtime client error raised: node with id 39 is already cached LonaRuntimeWorker_0 ERROR 12:39:31.345355 lona.view_runtime Exception raised while running </home/fscherf/devel/lona/test_project/views/view_types/interactive_view.py.InteractiveView object at 0x7f979c06cc10> Traceback (most recent call last): File "/home/fscherf/devel/lona/lona/view_runtime.py", line 348, in start return_value=self.view.handle_request(self.request), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/fscherf/devel/lona/test_project/views/view_types/interactive_view.py", line 56, in handle_request self.sleep(float(interval.value)) File "/home/fscherf/devel/lona/lona/view.py", line 344, in sleep return self._await_sync(asyncio.sleep(delay, result)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/fscherf/devel/lona/lona/view.py", line 109, in _await_sync ).result() ^^^^^^^^ File "/home/fscherf/.pyenv/versions/3.11.4/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/home/fscherf/.pyenv/versions/3.11.4/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/home/fscherf/devel/lona/lona/view.py", line 104, in await_awaitable raise cast(StopReason, self._view_runtime.stop_reason) The second log entry does not contain any meaningful information, and the Python traceback only contains Lona framework code, never application code. Thus it only made these errors harder to read. This patch adds a new rule to `lona.logging.LogFilter` to filter out log entries containing a `lona.errors.ClientError` traceback. Signed-off-by: Florian Scherf <mail@florianscherf.de>
Previously, client2 crashed when an already rendered node was moved by appending or inserting it twice within the same HTML tree. moving_node = Div('node 3') html = HTML( Div( 'node 1', moving_node, ), Div('node 2'), ) self.show(html) html[1].append(moving_node) self.show(html) # resulted in: ERROR lona.view_runtime client error raised: node with id 952 is already cached When a node is moved by adding it twice to the same node tree, internally, it gets destroyed at the old location, and a new node, with the old id, gets rendered in the new location. Previously, the rendering engines node cache got not cleaned after the first step, so all child nodes of `moving_node`, which is a text node with the text "node 3" in this case, remained cached. When the rendering engine attempted to render a new div, identical to the former removed one, the cache function would raise an error because the old text node still was cached. This patch adds a cache cleaning call to the rendering engines `_remove_node` method and adds a rendering test for moving nodes. Signed-off-by: Florian Scherf <mail@florianscherf.de>
fscherf
force-pushed
the
fscherf/fix-rendering-issue
branch
from
July 13, 2023 13:29
9eea5e0
to
3cd59e6
Compare
SmithChart
approved these changes
Jul 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any insight to the Javascript-side, so I am probably not the one to have an opinion on that.
Otherwise. LGTM.
@SmithChart: Thanks for having a look anyway! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a rendering problem in client2 when moving nodes within a tree, and contains a patch to make client errors more readable in log