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

Add default auto refresh config #21351

Merged
merged 7 commits into from
Jan 28, 2025
Merged

Add default auto refresh config #21351

merged 7 commits into from
Jan 28, 2025

Conversation

maxiadlovskii
Copy link
Contributor

@maxiadlovskii maxiadlovskii commented Jan 14, 2025

Description

This PR adds the option to add default auto-refresh config to AutoRefreshProvider
We are changing the default config for Events. Now it's starts automatically with a default interval from configuration

Motivation and Context

fix: #21350

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

import type { RefreshConfig } from 'views/components/contexts/AutoRefreshContext';
import { durationToMS } from 'util/DateTime';

const defaultInterval = 'PT30S';
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure if we should hardcode it. What are arguments against reusing the search refresh defaults for this? 5s does not seem to be too low for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dennisoelkers 30 sec that was a product requirement.

Copy link
Member

Choose a reason for hiding this comment

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

Can you clarify if it was even considered to reuse the configurable values or if that number was just an educated guess, without knowing that a user can configure it in other places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I addressed this question. Let's wait for a response

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dennisoelkers After discussions we decided to use the default interval from configuration. Pushed the changes

@@ -49,6 +49,12 @@ const AutoRefreshProvider = ({ children, onRefresh }: React.PropsWithChildren<{
};
}, [refreshConfig?.enabled, refreshConfig?.interval, onRefresh, animationId]);

useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this second useEffect, we should set defaultRefreshConfig as the initial value for refreshConfig in the useState call.

Copy link
Member

@dennisoelkers dennisoelkers left a comment

Choose a reason for hiding this comment

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

Great work, thanks!

@dennisoelkers dennisoelkers merged commit 96bbe6f into master Jan 28, 2025
7 checks passed
@dennisoelkers dennisoelkers deleted the fix/issue-21350 branch January 28, 2025 08:04
dennisoelkers pushed a commit that referenced this pull request Jan 30, 2025
* Add default auto refresh config

* Add changelog

* fix eslint

* Add default interval usage

* improvement. remove useEffect
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

Successfully merging this pull request may close these issues.

Start autorefresh automatically with interval 30s on Events page
2 participants