-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] move from slice to reducers/actions and simplify loading #113324
[Lens] move from slice to reducers/actions and simplify loading #113324
Conversation
1df0b6d
to
2750888
Compare
initEmpty({ | ||
newState: { | ||
...emptyState, | ||
searchSessionId: currentSessionId || data.search.session.start(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what fixes the mentioned bug - somehow it was lost in the previous PRs and undefined searchSessionId caused infinite loop of requesting for data.
expect(deps.lensServices.attributeService.unwrapAttributes).not.toHaveBeenCalled(); | ||
}); | ||
|
||
it('starts new searchSessionId', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the new test that tests the bug this PR fixes. The rest is refactored to test the whole path from invoking loadInitial (we do it in mounter) to run through middleware and reducer (before it was only checking middleware in separation)
import moment from 'moment'; | ||
import { initialState } from './lens_slice'; | ||
import { LensAppState } from './types'; | ||
import { PayloadAction } from '@reduxjs/toolkit'; | ||
|
||
const sessionIdSubject = new Subject<string>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these lines are now being shared from mocks file.
Pinging @elastic/kibana-vis-editors (Team:VisEditors) |
2750888
to
448cc01
Compare
448cc01
to
9cb6f34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review, left a couple fo comments.
const suggestions = getSuggestions({ | ||
datasourceMap, | ||
datasourceStates, | ||
visualizationMap, | ||
activeVisualization, | ||
visualizationState, | ||
activeVisualization: visualizationMap?.[Object.keys(visualizationMap)[0]] || null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate?
@@ -94,7 +100,7 @@ describe('Lens App', () => { | |||
|
|||
async function mountWith({ | |||
props = makeDefaultProps(), | |||
services = makeDefaultServices(sessionIdSubject), | |||
services = makeDefaultServices(sessionIdSubject, 'sessionId-1'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be a const
ant on top?
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally in Chrome 👍
…tic#113324) * structure changes * tests & fix for sessionId * share mocks in time_range_middleware * make switchVisualization and selectSuggestion one reducer as it's very similar * CR Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
) (#113740) * structure changes * tests & fix for sessionId * share mocks in time_range_middleware * make switchVisualization and selectSuggestion one reducer as it's very similar * CR Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Marta Bondyra <[email protected]>
Summary
Fixes #113218 - it was caused by not creating the new searchSession on start.