Tier 6: Migrate 8 standalone Reflux stores to react-query hooks and plain functions#25822
Open
dennisoelkers wants to merge 5 commits intomasterfrom
Open
Tier 6: Migrate 8 standalone Reflux stores to react-query hooks and plain functions#25822dennisoelkers wants to merge 5 commits intomasterfrom
dennisoelkers wants to merge 5 commits intomasterfrom
Conversation
…lain functions Replace 8 Reflux stores with modern alternatives: - AuthenticationStore → `hooks/useAuthentication.ts` (react-query hooks + plain functions) - SidecarsStore → `hooks/useSidecars.ts` (react-query hook with polling) - CollectorsStore → `hooks/useCollectors.ts` (react-query hooks) - CollectorConfigurationsStore → `hooks/useCollectorConfigurations.ts` (react-query hooks) - AuthzRolesStore → `hooks/useAuthzRoles.ts` (plain functions + react-query hooks) - ExtractorsStore → `hooks/useExtractors.ts` (plain functions + react-query hooks) - EntityShareStore → `api/entity-share.ts` + `hooks/useEntityShareState.ts` (react-query cache) - IndicesStore → `hooks/useIndices.ts` (react-query hooks with polling) Also refactored consumers to use hook-based patterns instead of `.then(setState)` flows and replaced Reflux `completed.listen` patterns with react-query cache invalidation or prop-drilled callbacks. Known follow-ups: 4 test cases in EntityShareModal/StreamModal/RolesOverview/UsersSection need further mock updates for the new cache-based EntityShareState flow. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Update useEntityShareState to provide a noop queryFn (react-query v5
requires queryFn even when enabled: false) and wrap the setter from
useSetEntityShareState in useCallback so consumer useEffect deps stay
stable across renders.
- Add placeholderData: keepPreviousData to RolesOverview's paginated
useQuery so the SearchForm stays mounted (keeping its internal query
state and Reset button) during refetch.
- Update UsersSection test assertion to match the new 2-arg
loadUsersForRole(roleId, pagination) signature.
- Update EntityShareModal test mock helpers to the new { data } query
result shape.
- Hoist mockSetEntityShareState out of the jest.mock factory across all
EntityShareState test mocks so the returned setter has a stable
reference (was a new jest.fn() per call, causing infinite re-renders).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
Replace 8 Reflux stores with modern alternatives:
hooks/useAuthentication.ts(react-query hooks + plain functions)hooks/useSidecars.ts(react-query hook with polling)hooks/useCollectors.ts(react-query hooks)hooks/useCollectorConfigurations.ts(react-query hooks)hooks/useAuthzRoles.ts(plain functions + react-query hooks)hooks/useExtractors.ts(plain functions + react-query hooks)api/entity-share.ts+hooks/useEntityShareState.ts(react-query cache)hooks/useIndices.ts(react-query hooks with polling)Also refactored consumers to use hook-based patterns instead of
.then(setState)flowsand replaced Reflux
completed.listenpatterns with react-query cache invalidation orprop-drilled callbacks.
Known follow-ups: 4 test cases in EntityShareModal/StreamModal/RolesOverview/UsersSection
need further mock updates for the new cache-based EntityShareState flow.
/nocl Internal refactoring.
/prd Graylog2/graylog-plugin-enterprise#14068
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: