diff --git a/.docker_files/main/__manifest__.py b/.docker_files/main/__manifest__.py index 7bb1793..52e6673 100644 --- a/.docker_files/main/__manifest__.py +++ b/.docker_files/main/__manifest__.py @@ -1,4 +1,4 @@ -# © 2023 Numigi +# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { @@ -12,6 +12,7 @@ "summary": "Install all addons required for testing.", "depends": [ "web", + "resize_observer_error_catcher", ], "installable": True, } diff --git a/Dockerfile b/Dockerfile index d8006a2..2b982fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,5 +18,7 @@ RUN pip3 install -r test-requirements.txt USER odoo +COPY resize_observer_error_catcher /mnt/extra-addons/resize_observer_error_catcher + COPY .docker_files/main /mnt/extra-addons/main COPY .docker_files/odoo.conf /etc/odoo diff --git a/resize_observer_error_catcher/README.rst b/resize_observer_error_catcher/README.rst new file mode 100644 index 0000000..e55e86a --- /dev/null +++ b/resize_observer_error_catcher/README.rst @@ -0,0 +1,20 @@ +============================= +Resize Observer Error Catcher +============================= + +This module prevent the raising of an error when resizing the window (by zoom in or zoom out). +Here are the errors that the module skipped : +- `ResizeObserver loop completed with undelivered notifications` +- `ResizeObserver loop limit exceeded` + +.. image:: static/description/resize_observer_error.png + +Contributors +------------ + +* Numigi (tm) and all its contributors (https://bit.ly/numigiens) + +More information +---------------- + +* Meet us at https://bit.ly/numigi-com diff --git a/resize_observer_error_catcher/__init__.py b/resize_observer_error_catcher/__init__.py new file mode 100644 index 0000000..80d97c3 --- /dev/null +++ b/resize_observer_error_catcher/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/resize_observer_error_catcher/__manifest__.py b/resize_observer_error_catcher/__manifest__.py new file mode 100644 index 0000000..35df47a --- /dev/null +++ b/resize_observer_error_catcher/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Resize Observer Error Catcher", + "summary": "Skip Resize Observer interface error when zooming.", + "version": "16.0.1.0.0", + "website": "https://bit.ly/numigi-com", + "author": "Numigi", + "maintainer": "Numigi", + "license": "AGPL-3", + "depends": ["base_setup"], + "data": [], + "assets": { + "web.assets_backend": [ + "resize_observer_error_catcher/static/src/js/resize_observer_catcher.js", + ], + }, + "installable": True, +} diff --git a/resize_observer_error_catcher/static/description/icon.png b/resize_observer_error_catcher/static/description/icon.png new file mode 100644 index 0000000..92a86b1 Binary files /dev/null and b/resize_observer_error_catcher/static/description/icon.png differ diff --git a/resize_observer_error_catcher/static/description/resize_observer_error.png b/resize_observer_error_catcher/static/description/resize_observer_error.png new file mode 100644 index 0000000..a2c3e08 Binary files /dev/null and b/resize_observer_error_catcher/static/description/resize_observer_error.png differ diff --git a/resize_observer_error_catcher/static/src/js/resize_observer_catcher.js b/resize_observer_error_catcher/static/src/js/resize_observer_catcher.js new file mode 100644 index 0000000..355ecf2 --- /dev/null +++ b/resize_observer_error_catcher/static/src/js/resize_observer_catcher.js @@ -0,0 +1,16 @@ +odoo.define('resize_observer_error_catcher.handling_error', function (require) { + "use strict"; + +window.addEventListener('error', (e) => { +if ( + [ + 'ResizeObserver loop completed with undelivered notifications.', + 'ResizeObserver loop limit exceeded', + /* add more if needed */ + ].includes(e.message) +) { + e.stopImmediatePropagation(); +} +}); + +});