OCA / web

Odoo web client UI related addons
GNU Affero General Public License v3.0
900 stars 1.85k forks source link

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

Open robyf70 opened 3 months ago

robyf70 commented 3 months ago

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)
OCA-git-bot commented 3 months ago

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

LoisRForgeFlow commented 3 months ago

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.

robyf70 commented 3 months ago

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?

LoisRForgeFlow commented 3 months ago

@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.

robyf70 commented 3 months ago

@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 commented 3 months ago

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

robyf70 commented 3 months ago

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 commented 2 months ago

@LoisRForgeFlow How to we proceed with this PR?

LoisRForgeFlow commented 2 months ago

@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: