From b37560cbeb9e8f2427d19190400192636ae8a467 Mon Sep 17 00:00:00 2001 From: Nikhil Rao Date: Fri, 16 Jun 2023 13:32:35 -0700 Subject: [PATCH] Fix frontend event infinite loop (#1207) --- pynecone/.templates/web/utils/state.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pynecone/.templates/web/utils/state.js b/pynecone/.templates/web/utils/state.js index c12c9f7d8..3f51689a2 100644 --- a/pynecone/.templates/web/utils/state.js +++ b/pynecone/.templates/web/utils/state.js @@ -166,10 +166,10 @@ export const processEvent = async ( setResult({ ...result, processing: true }); // Apply the next event in the queue. - const event = state.events[0]; + const event = state.events.shift(); // Set new events to avoid reprocessing the same event. - setState(state => ({ ...state, events: state.events.slice(1) })); + setState(state => ({ ...state, events: state.events })); // Process events with handlers via REST and all others via websockets. let eventSent = false;