Skip to content

Commit

Permalink
Drop unnecessary async in useTSHtmlEvents hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansick committed Apr 8, 2024
1 parent 67b1e97 commit b619acd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/squareone/src/hooks/useTimesSquareHtmlEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function useTimesSquareHtmlEvents(htmlEventsUrl, urlQueryString) {

const fullHtmlEventsUrl = `${htmlEventsUrl}?${urlQueryString}`;

React.useEffect(async () => {
React.useEffect(() => {
async function runEffect() {
if (htmlEventsUrl) {
console.log(`Running fetchEventSource ${fullHtmlEventsUrl}`);
Expand Down Expand Up @@ -45,8 +45,10 @@ function useTimesSquareHtmlEvents(htmlEventsUrl, urlQueryString) {
});
}
}
console.log('running effect');
runEffect();

console.log('returning cleanup function');
return () => {
// Clean up: close the event source connection
console.log(`❌ CLOSING CONNECTION TO ${fullHtmlEventsUrl}`);
Expand Down

0 comments on commit b619acd

Please sign in to comment.