web icon indicating copy to clipboard operation
web copied to clipboard

[16.0][FIX] Fix rendering when height/width is zero

Open robyf70 opened this issue 1 year ago • 9 comments

The bokeh v3.1.1 has a issue when the canvas has width/height at zero. This happen when moving from a view form to tree view and the Bokeh widget is going to be destroyed. Javascript console report issue below. The fix has been introduced in v3.2.x of the library.

InvalidStateError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
    at g.blit_webgl (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:464:2802) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:464)
    at _._paint_levels (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582:15891) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582)
    at _._actual_paint (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582:15197) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582)
    at _.paint (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582:14153) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582)
    at _._after_layout (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582:13990) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:582)
    at _.after_layout (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:547:6160) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:547)
    at _.compute_layout (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:547:5540) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:547)
    at _._after_resize (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:547:732) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:547)
    at _.after_resize (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:430:2547) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:430)
    at ResizeObserver.<anonymous> (web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:430:2043) (http://localhost:8069/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js:430)

robyf70 avatar Apr 09 '24 10:04 robyf70

Hi @ChrisOForgeFlow, @LoisRForgeFlow, some modules you are maintaining are being modified, check this out!

OCA-git-bot avatar Apr 09 '24 10:04 OCA-git-bot

Hi @robyf70

We don't update the library version once merged in an odoo stable version, as it affect existing usages of the widget.

The migration to v17 or v18 will be the oportunity to do this update.

Sorrry for the inconvenience.

LoisRForgeFlow avatar Apr 09 '24 14:04 LoisRForgeFlow

Hi @robyf70

We don't update the library version once merged in an odoo stable version, as it affect existing usages of the widget.

The migration to v17 or v18 will be the oportunity to do this update.

Sorrry for the inconvenience.

Hi @LoisRForgeFlow,

I agree 100% with you, however what about this case if the library is breaking the navigation and crash?

robyf70 avatar Apr 09 '24 14:04 robyf70

@robyf70 Do you have a use case that you can share? Maybe you can point to the bokeh chart computation and/or share a video of how it crashes.

LoisRForgeFlow avatar Apr 09 '24 15:04 LoisRForgeFlow

@robyf70 Do you have a use case that you can share? Maybe you can point to the bokeh chart computation and/or share a video of how it crashes.

Sure please see this video

https://github.com/OCA/web/assets/1663021/b91ffb77-4399-4039-ae07-4844d7054d43

robyf70 avatar Apr 09 '24 15:04 robyf70

As you can see I'm just getting back to the tree view using the breadcrumb and then crashes

robyf70 avatar Apr 09 '24 15:04 robyf70

and forgot to mention the Bokeh PR to fix the issue which is on branch-3.2, see https://github.com/bokeh/bokeh/pull/13140/files

robyf70 avatar Apr 09 '24 15:04 robyf70

@LoisRForgeFlow How to we proceed with this PR?

robyf70 avatar May 15 '24 15:05 robyf70

@robyf70 I still think we should stick to the stable version rules and keep it as is in 16.0. However I will make sure that the bokeh version is updated in 17.0. I already pinged the author of the v17 migration asking to update bokeh version there.

In your case, you can use this PR in your instalations to have the newer version and avoid the bug that you are facing. I know is not the ideal solution for you, but there is a risk of impacting many current users of the module if we do this update.

I hope you understand and sorry for the inconveniences :pray:

LoisRForgeFlow avatar May 16 '24 14:05 LoisRForgeFlow