Skip to content

[App Search] Minor var names follow-up#87258

Merged
cee-chen merged 2 commits intoelastic:masterfrom
cee-chen:var-renames
Jan 5, 2021
Merged

[App Search] Minor var names follow-up#87258
cee-chen merged 2 commits intoelastic:masterfrom
cee-chen:var-renames

Conversation

@cee-chen
Copy link
Copy Markdown
Contributor

@cee-chen cee-chen commented Jan 4, 2021

Summary

Follow up to #86702 (comment): a var rename suggestion and then a little more because I can't leave well enough alone

Checklist

- so it doesn't sound negative or like a bug, but is instead an anticipated load/use case
- remove unncessary function
- move declaration down to right before it's used
- Rename engineNameParam to engineNameFromUrl to make reading flow a little bit more nicely + hopefully make the var source a bit clearer

- Change other references back to engineName for simplicity (they should really only be running after engineName has already been set, so there shouldn't be any race conditions there - moving engineBreadcrumb to after Loading should also solve that)
@cee-chen cee-chen added release_note:skip Skip the PR/issue when compiling release notes v7.12.0 labels Jan 4, 2021
@cee-chen cee-chen requested review from a team and JasonStoltz January 4, 2021 23:24
},
} = useValues(AppLogic);

const { engineName: engineNameFromUrl } = useParams() as { engineName: string };
Copy link
Copy Markdown
Contributor Author

@cee-chen cee-chen Jan 4, 2021

Choose a reason for hiding this comment

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

Feel free to push back if you disagree, but I was thinking FromUrl flowed a little better reading-wise and also made it a little clearer where we're setting engineName from. I also played with engineNameFromParam but ended up likeing FromUrl a little better

defaultMessage: "No engine with name '{engineNameParam}' could be found.",
values: { engineNameParam },
defaultMessage: "No engine with name '{engineName}' could be found.",
values: { engineName },
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There isn't really a realistic scenario where engineName would get set after engineNotFound gets set so I think it's safe to simplify this

const isLoadingNewEngine = engineName !== engineNameFromUrl;
if (isLoadingNewEngine || dataLoading) return <Loading />;

const engineBreadcrumb = [ENGINES_TITLE, engineName];
Copy link
Copy Markdown
Contributor Author

@cee-chen cee-chen Jan 4, 2021

Choose a reason for hiding this comment

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

Similarly, I wanted to simplify engineBreadcrumb to just use engineName (and also to think of engineName as a source of truth once an engine is initialized from url), so I moved this to after the Loading component to reduce confusion & keep the logic together.

@cee-chen cee-chen changed the title Var renames [Enterprise Saerch] Minor var names follow-up Jan 4, 2021
@cee-chen cee-chen changed the title [Enterprise Saerch] Minor var names follow-up [Enterprise Search] Minor var names follow-up Jan 4, 2021
@cee-chen cee-chen changed the title [Enterprise Search] Minor var names follow-up [App Search] Minor var names follow-up Jan 4, 2021
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

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
enterpriseSearch 1.8MB 1.8MB -22.0B

Distributable file count

id before after diff
default 47247 48007 +760

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

@cee-chen cee-chen merged commit 3fba476 into elastic:master Jan 5, 2021
@cee-chen cee-chen deleted the var-renames branch January 5, 2021 17:04
cee-chen pushed a commit that referenced this pull request Jan 5, 2021
* Var rename

- so it doesn't sound negative or like a bug, but is instead an anticipated load/use case
- remove unncessary function
- move declaration down to right before it's used

* [Proposal] Other misc cleanup

- Rename engineNameParam to engineNameFromUrl to make reading flow a little bit more nicely + hopefully make the var source a bit clearer

- Change other references back to engineName for simplicity (they should really only be running after engineName has already been set, so there shouldn't be any race conditions there - moving engineBreadcrumb to after Loading should also solve that)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes v7.12.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants