Skip to content

Commit

Permalink
Remove console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Jun 4, 2023
1 parent e620e8a commit 394c77b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export const DebugEntriesListModal = ({onClick, onClose, open}: DebugEntriesList
const [filters, setFilters] = useState(() => ['web', 'console', 'current']);
const currentPageRequestIds = useCurrentPageRequestIds();

console.log('currentPageRequestIds', currentPageRequestIds);

const handleFormat = (event: MouseEvent<HTMLElement>, newFormats: string[]) => {
setFilters(newFormats);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {addCurrentPageRequestId, changeEntryAction, useDebugEntry} from '@yiisof
import {DebugEntry, debugApi, useGetDebugQuery} from '@yiisoft/yii-dev-panel-sdk/API/Debug/Debug';
import {YiiIcon} from '@yiisoft/yii-dev-panel-sdk/Component/SvgIcon/YiiIcon';
import {isDebugEntryAboutConsole, isDebugEntryAboutWeb} from '@yiisoft/yii-dev-panel-sdk/Helper/debugEntry';
import * as serviceWorkerRegistration from '@yiisoft/yii-dev-panel-sdk/serviceWorkerRegistration';
import {DebugEntriesListModal} from '@yiisoft/yii-dev-toolbar/Module/Toolbar/Component/DebugEntriesListModal';
import {CommandItem} from '@yiisoft/yii-dev-toolbar/Module/Toolbar/Component/Toolbar/Console/CommandItem';
import {DateItem} from '@yiisoft/yii-dev-toolbar/Module/Toolbar/Component/Toolbar/DateItem';
Expand All @@ -27,33 +26,19 @@ let serviceWorker = navigator?.serviceWorker;

export const DebugToolbar = () => {
useEffect(() => {
const config = {
onSuccess: (registration: ServiceWorkerRegistration) => {
console.log('onSuccess', registration);
},
onUpdate: (registration) => {
console.log('onUpdate', registration);
// if (registration && registration.waiting) {
// registration.waiting.postMessage({type: 'SKIP_WAITING'});
// }
},
};

serviceWorkerRegistration.register(config);

console.debug('[START] Listen to message');
// console.debug('[START] Listen to message');
const onMessageHandler = (event) => {
if (!event.data.payload || !('x-debug-id' in event.data.payload.headers)) {
return;
}
console.debug('[EVENT] Listen to message', event.data);
// console.debug('[EVENT] Listen to message', event.data);
dispatch(debugApi.util.invalidateTags(['debug/list']));
dispatch(addCurrentPageRequestId(event.data.payload.headers['x-debug-id']));
};
serviceWorker?.addEventListener('message', onMessageHandler);

return () => {
console.debug('[STOP] Listen to message');
// serviceWorkerRegistration.unregister();
// console.debug('[STOP] Listen to message');
serviceWorker?.removeEventListener('message', onMessageHandler);
};
}, []);
Expand Down

0 comments on commit 394c77b

Please sign in to comment.