Implement submissions polling interval feature in SubmissionsPage, allowing dynamic adjustment of API request frequency based on configuration.
This commit is contained in:
@@ -23,6 +23,7 @@ module.exports = {
|
|||||||
features: {
|
features: {
|
||||||
'challenge-admin': {
|
'challenge-admin': {
|
||||||
'use-chain-submissions-api': { value: 'true' },
|
'use-chain-submissions-api': { value: 'true' },
|
||||||
|
'submissions-polling-interval-ms': { value: '1200' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
|
|||||||
@@ -41,9 +41,18 @@ export const SubmissionsPage: React.FC = () => {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { chainId } = useParams<{ chainId?: string }>()
|
const { chainId } = useParams<{ chainId?: string }>()
|
||||||
|
|
||||||
// Проверяем feature flag
|
// Проверяем feature flags
|
||||||
const featureValue = getFeatureValue('challenge-admin', 'use-chain-submissions-api')
|
const featureValue = getFeatureValue('challenge-admin', 'use-chain-submissions-api')
|
||||||
const useNewApi = featureValue?.value === 'true'
|
const useNewApi = featureValue?.value === 'true'
|
||||||
|
const pollingIntervalFeatureValue = getFeatureValue(
|
||||||
|
'challenge-admin',
|
||||||
|
'submissions-polling-interval-ms'
|
||||||
|
)
|
||||||
|
const pollingIntervalMs = (() => {
|
||||||
|
const rawValue = pollingIntervalFeatureValue?.value ?? ''
|
||||||
|
const parsed = Number.parseInt(rawValue, 10)
|
||||||
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 1200
|
||||||
|
})()
|
||||||
|
|
||||||
// Состояние для выбранного пользователя и фильтров
|
// Состояние для выбранного пользователя и фильтров
|
||||||
const [selectedUserId, setSelectedUserId] = useState<string | null>(null)
|
const [selectedUserId, setSelectedUserId] = useState<string | null>(null)
|
||||||
@@ -72,7 +81,7 @@ export const SubmissionsPage: React.FC = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
skip: !chainId || !useNewApi,
|
skip: !chainId || !useNewApi,
|
||||||
pollingInterval: 1200,
|
pollingInterval: pollingIntervalMs,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user