mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Return early in ws message handler if no 'command' keyword is found (#7946)
## Summary Avoid processing websocket messages not n8n sent (filter on 'command' keyword)
This commit is contained in:
@@ -136,21 +136,22 @@ const onMouseLeave = () => {
|
||||
};
|
||||
|
||||
const receiveMessage = ({ data }: MessageEvent) => {
|
||||
if (data?.includes('"command"')) {
|
||||
try {
|
||||
const json = JSON.parse(data);
|
||||
if (json.command === 'n8nReady') {
|
||||
ready.value = true;
|
||||
} else if (json.command === 'openNDV') {
|
||||
nodeViewDetailsOpened.value = true;
|
||||
} else if (json.command === 'closeNDV') {
|
||||
nodeViewDetailsOpened.value = false;
|
||||
} else if (json.command === 'error') {
|
||||
emit('close');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
if (!data?.includes?.('"command"')) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const json = JSON.parse(data);
|
||||
if (json.command === 'n8nReady') {
|
||||
ready.value = true;
|
||||
} else if (json.command === 'openNDV') {
|
||||
nodeViewDetailsOpened.value = true;
|
||||
} else if (json.command === 'closeNDV') {
|
||||
nodeViewDetailsOpened.value = false;
|
||||
} else if (json.command === 'error') {
|
||||
emit('close');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
const onDocumentScroll = () => {
|
||||
|
||||
Reference in New Issue
Block a user