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

[Discover] Rename internalState to sharedState #157830

Closed
wants to merge 8 commits into from

Conversation

kertal
Copy link
Member

@kertal kertal commented May 16, 2023

Summary

It's renaming DiscoverInternalStateContainer (and dependencies) to DiscoverSharedStateContainer (it was mentioned by @mattkime that it's misleading, because internalState might indicate it's sort of private ... shared state is better naming IMO)

Checklist

@kertal kertal self-assigned this May 16, 2023
@kertal kertal added Feature:Discover Discover Application Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. release_note:skip Skip the PR/issue when compiling release notes labels May 16, 2023
@kertal kertal marked this pull request as ready for review May 16, 2023 15:09
@kertal kertal requested a review from a team as a code owner May 16, 2023 15:09
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

useSelector: useDiscoverSharedStateSelector,
} = createStateContainerReactHelpers<ReduxLikeStateContainer<DiscoverSharedState>>();

export function getSharedStateContainer() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Github seems to think this is a new file, but just the file and functions and types were renamed

@kertal kertal changed the title [Discover] Rename internalState to sharedState, remove kbnUrlStateStorage [Discover] Rename internalState to sharedState, remove redundant functionality May 22, 2023
@@ -24,7 +24,7 @@ describe('buildStateSubscribe', () => {
appState: stateContainer.appState,
savedSearchState: stateContainer.savedSearchState,
dataState: stateContainer.dataState,
internalState: stateContainer.internalState,
internalState: stateContainer.sharedState,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
internalState: stateContainer.sharedState,
sharedState: stateContainer.sharedState,

Shouldn't it be updated too?

Copy link
Member Author

Choose a reason for hiding this comment

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

definitely, well apply and align those suggestions 👍 thx

@@ -36,7 +36,7 @@ export const buildStateSubscribe =
}: {
appState: DiscoverAppStateContainer;
dataState: DiscoverDataStateContainer;
internalState: DiscoverInternalStateContainer;
internalState: DiscoverSharedStateContainer;
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

@@ -26,7 +26,7 @@ export async function changeDataView(
appState,
}: {
services: DiscoverServices;
internalState: DiscoverInternalStateContainer;
internalState: DiscoverSharedStateContainer;
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

@@ -235,7 +225,7 @@ export function getDiscoverStateContainer({
/**
* Internal State Container, state that's not persisted and not part of the URL
*/
const internalStateContainer = getInternalStateContainer();
const internalStateContainer = getSharedStateContainer();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename to sharedStateContainer for consistency?

Copy link
Member Author

Choose a reason for hiding this comment

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

definitely!

@@ -324,18 +314,6 @@ export function getDiscoverStateContainer({
fetchData();
};

const persistAdHocDataView = async (adHocDataView: DataView) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where did we move this logic to?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's no longer necessary because of #154947
We needed to persist a temporary data view before sharing or creating CSVs , now it's possible without

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. Thanks for explaining!

@@ -26,7 +26,7 @@ import { DiscoverServices } from '../../../build_services';
interface LoadSavedSearchDeps {
appStateContainer: DiscoverAppStateContainer;
dataStateContainer: DiscoverDataStateContainer;
internalStateContainer: DiscoverInternalStateContainer;
internalStateContainer: DiscoverSharedStateContainer;
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

@@ -180,7 +180,7 @@ export const loadAndResolveDataView = async (
{
internalStateContainer,
services,
}: { internalStateContainer: DiscoverInternalStateContainer; services: DiscoverServices }
}: { internalStateContainer: DiscoverSharedStateContainer; services: DiscoverServices }
Copy link
Contributor

Choose a reason for hiding this comment

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

And here

@kertal
Copy link
Member Author

kertal commented May 23, 2023

Splitted out #158225

@kertal kertal changed the title [Discover] Rename internalState to sharedState, remove redundant functionality [Discover] Rename internalState to sharedState May 23, 2023
@kibana-ci
Copy link
Collaborator

kibana-ci commented May 23, 2023

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Integration Tests #1 / migration v2 with corrupt saved object documents collects corrupt saved object documents across batches

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 421.1KB 421.1KB -48.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 399 403 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 479 483 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @kertal

@kertal
Copy link
Member Author

kertal commented May 30, 2023

Closing since we discussed in the team, and considered this renaming as to be redundant

@kertal kertal closed this May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants