mirror of
https://github.com/HeyPuter/puter.git
synced 2026-07-26 08:51:45 +00:00
fix: prevent unnecessary updates on socket events
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test (20.x) (push) Has been cancelled
test / test (22.x) (push) Has been cancelled
test / api-test (22.x) (push) Has been cancelled
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test (20.x) (push) Has been cancelled
test / test (22.x) (push) Has been cancelled
test / api-test (22.x) (push) Has been cancelled
Updated the `bindSocketEvents` method to check the `original_client_socket_id` before posting updates for 'cache.updated' and 'item.renamed' events. This prevents unnecessary updates when the event originates from the same client socket.
This commit is contained in:
@@ -113,8 +113,22 @@ export class PuterJSFileSystemModule extends AdvancedBase {
|
||||
}
|
||||
|
||||
bindSocketEvents() {
|
||||
this.socket.on('cache.updated', (item) => {
|
||||
this.postUpdate();
|
||||
this.socket.on('cache.updated', (msg) => {
|
||||
// check original_client_socket_id and if it matches this.socket.id, don't post update
|
||||
if (msg.original_client_socket_id === this.socket.id) {
|
||||
return;
|
||||
}else{
|
||||
this.postUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
this.socket.on('item.renamed', (item) => {
|
||||
// check original_client_socket_id and if it matches this.socket.id, don't post update
|
||||
if (item.original_client_socket_id === this.socket.id) {
|
||||
return;
|
||||
}else{
|
||||
this.postUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
this.socket.on('connect', () => {
|
||||
|
||||
Reference in New Issue
Block a user