Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't poll metrics when user is interacting with graph #8504

Open
linear bot opened this issue May 8, 2024 · 2 comments
Open

Don't poll metrics when user is interacting with graph #8504

linear bot opened this issue May 8, 2024 · 2 comments

Comments

@linear
Copy link

linear bot commented May 8, 2024

No description provided.

Copy link
Author

linear bot commented May 8, 2024

Copy link

greptile-apps bot commented May 8, 2024

To prevent polling metrics during user interaction with the graph, you can modify the Graph component in /frontend/src/pages/Graphing/components/Graph.tsx. Implement state management to track user interaction states (e.g., dragging, hovering) and use these states to conditionally pause and resume the useGetMetricsQuery polling. Here's a high-level approach:

  1. Introduce a new state variable to track interaction, e.g., const [isInteracting, setIsInteracting] = useState(false).
  2. Adjust event handlers like onMouseDown, onMouseMove, and onMouseUp to set isInteracting to true or false accordingly.
  3. Modify the useGetMetricsQuery hook call to include the pollInterval option, and conditionally set this based on the isInteracting state. For example, pollInterval: isInteracting ? 0 : 5000 to stop polling during interaction.

This approach ensures that metric data polling is paused during user interactions with the graph, optimizing performance and user experience.

References

/frontend/src/pages/Graphing/components/Graph.tsx

Ask Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants