Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Feb 26, 2024
1 parent 9cc21fe commit 2a439ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions web_src/js/behaviours/overflow-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const update = throttle(100, (menu) => {

if (buttonItems.length && !menu.querySelector('.overflow-menu-button')) {
const btn = document.createElement('button');
btn.classList.add('overflow-menu-button', 'btn', 'tw-px-4');
btn.classList.add('overflow-menu-button', 'btn', 'tw-px-2');
btn.innerHTML = svg('octicon-kebab-horizontal');

const itemsMenu = document.createElement('div');
itemsMenu.classList.add('overflow-menu-tippy', 'ui', 'vertical', 'menu');
itemsMenu.classList.add('overflow-menu-tippy', 'ui', 'secondary', 'vertical', 'menu');
for (const item of buttonItems) {
itemsMenu.append(item);
}
Expand All @@ -43,9 +43,12 @@ export function initOverflowMenu() {
for (const el of document.querySelectorAll('.overflow-menu')) {
update(el);
(new ResizeObserver((entries) => {
for (const entry of entries) {
update(entry.target);
}
// raf seems to avoid 'ResizeObserver loop completed with undelivered notifications' error
requestAnimationFrame(() => {
for (const entry of entries) {
update(entry.target);
}
});
})).observe(el);
}
}
3 changes: 2 additions & 1 deletion web_src/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function processWindowErrorEvent(e) {
const assetBaseUrl = String(new URL(__webpack_public_path__, window.location.origin));

// error is likely from browser extension or inline script. Do not show these in production builds.
if (!err.stack?.includes(assetBaseUrl) && window.config?.runModeIsProd) return;
if (err?.stack && !err.stack?.includes(assetBaseUrl) && window.config?.runModeIsProd) return;

let message;
if (e.type === 'unhandledrejection') {
Expand All @@ -49,6 +49,7 @@ function processWindowErrorEvent(e) {
}

showGlobalErrorMessage(`${message} Open browser console to see more details.`);
console.error(err ?? e);
}

function initGlobalErrorHandler() {
Expand Down

0 comments on commit 2a439ca

Please sign in to comment.