Skip to content

Conversation

@learningbizz
Copy link
Contributor

We had an issue where if you were in the runs page and you ran documents from somewhere else, the counter would count twice each run.

This was because we had the sidebar and the runs page using the useActiveRunsCount hook, which would create two listeners of the WS event, and mutate twice the frontend state.

This fix fixes that by creating a provider that uses this hook, and instantiating it in the layout for the children to use, and avoid duplicate counts.

We had an issue where if you were in the runs page and you ran documents from somewhere else, the counter would count twice each run. This was because we had the sidebar and the runs page using the useActiveRunsCount hook, which would create two listeners of the WS event, and mutate twice the frontend state. This fix fixes that by creating a provider that uses this hook, and instantiating it in the layout for the children to use, and avoid duplicate counts.
}

export function useActiveRunsCountContext() {
const context = useContext(ActiveRunsCountContext)
Copy link
Contributor

@andresgutgon andresgutgon Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now need for custom hook for context in react.

const myThing = use(ActiveRunsCountContext) 

Takes care of checking the provider is provided

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

top tyty for the KNOWLEDGE

andresgutgon
andresgutgon previously approved these changes Nov 10, 2025
@learningbizz learningbizz merged commit ba99d9e into main Nov 11, 2025
7 checks passed
@learningbizz learningbizz deleted the fix/double-count-runs branch November 11, 2025 11:29
@github-actions github-actions bot locked and limited conversation to collaborators Nov 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants