filter keep-alives

This commit is contained in:
Sebastian Jambor 2023-01-09 14:39:38 +01:00
parent 6ea9072f5b
commit 6e9842a257

View file

@ -18,14 +18,18 @@ export default function ActivityLog({ multiColumn }) {
default:
return state;
}
}, dummy_data);
// }, dummy_data);
}, []);
const columnElement = useRef(null);
useEffect(() => {
const eventSource = new EventSource('/api/v1/activity_log');
eventSource.onmessage = (event) => {
dispatch(['add-log-event', JSON.parse(event.data)]);
const parsed = JSON.parse(event.data);
if (parsed.type !== 'keep-alive') {
dispatch(['add-log-event', parsed]);
}
};
return function() {
@ -33,7 +37,6 @@ export default function ActivityLog({ multiColumn }) {
};
}, []);
const darkMode = !(document.body && document.body.classList.contains('theme-mastodon-light'));
return (
@ -45,6 +48,9 @@ export default function ActivityLog({ multiColumn }) {
multiColumn={multiColumn}
/>
<button onClick={() => navigator.clipboard.writeText(JSON.stringify(logs, null, 2))}>Copy logs</button>
<button onClick={() => dispatch(['reset-logs'])}>Clear logs</button>
<div className={`${darkMode ? 'dark' : ''}`}>
<ActivityPubVisualization logs={logs} />
</div>