-
Notifications
You must be signed in to change notification settings - Fork 5
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
[MM-64] Update plugin with respect to phase 1 upgrades #190
Conversation
#192) * Revert "Update main.go (#154)" This reverts commit be4a281. * Revert "[MM-33506] Use embed package to include plugin manifest (#145)" This reverts commit ca9ee3c. * Revert "Don't generate manifest.ts (#127)" This reverts commit 18d30b5. * install-go-tools target, adopt gotestsum * bring back make apply + automatic versioning * Update build/manifest/main.go Co-authored-by: Michael Kochell <[email protected]> * suppress git describe error when no tags match * make version/release notes opt-in * fix whitespace in Makefile * document version management options --------- Co-authored-by: Michael Kochell <[email protected]>
Co-authored-by: Jesse Hallam <[email protected]>
1cc1f5a
to
83f03ba
Compare
@mickmister Fixed the review comments. Please re-review. |
const globalState = (store.getState() as GlobalState); | ||
if (globalState.views?.rhs?.rhsState === 'plugin') { | ||
if (globalState.views.rhs.pluggableId === rhsComponentId) { | ||
store.dispatch(refetch() as Action); | ||
} | ||
} else { | ||
store.dispatch(refetch() as Action); | ||
} |
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.
We should make it so this else
essentially "never" happens. Meaning it should only happen if the redux store has changed its structure from what we currently assume. The first if should just be "does the redux structure match our expectations", and not make any assertions about the state of the store, as described in this comment #190 (comment)
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.
@mickmister Not sure whether I got your point or not. If the condition if (globalState.views?.rhs?.rhsState === 'plugin')
is false, how will we refetch if we remove the else condition?
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.
@ayusht2810 As far as I understand, we only want to refetch if the plugin's RHS is currently showing. The else
was added here in the case of "the redux store's structure itself changes in future iterations of the webapp codebase". That's a corner case that will essentially "never" be used, because the redux store structure will likely not change.
I'm not saying we should remove the else
condition. I'm saying that the branch that runs that will/should not happen unless the redux store structure changes.
This is how I think it should be implemented (verbosely):
const doesReduxStoreStructureMatchOurAssumptions = Boolean(globalState.views?.rhs && 'rhsState' in globalState.views?.rhs);
if (doesReduxStoreStructureMatchOurAssumptions) {
if (globalState.views?.rhs?.rhsState === 'plugin' && globalState.views?.rhs?.pluggableId === rhsComponentId) {
store.dispatch(refetch() as Action);
}
} else {
store.dispatch(refetch() as Action);
}
Personally I think we can get rid of the else
altogether, but the undocumented redux store structure could in theory change in the future, so it's not a bad idea to have code that defends against it. I'm 0/5 on if we need it, but we should only refetch the data when necessary given what the code has to work with. @ayusht2810 Does this all make sense?
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.
@mickmister Just for clarification:
- The
if
block present here for handling the older redux structure (i.e. for order MM versions), where we had access toglobalState.views
. - The
else
block is for handling the current redux structure with no access toglobalState.views
(i.e. latest MM version). So, if we remove the else block the RHS will not update until the user re-open it.
So, I do't think we should remove the else block as it will break the functionality on latest servers.
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.
cc: @wiggin77
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.
The else block is for handling the current redux structure with no access to globalState.views(i.e. latest MM version). So, if we remove the else block the RHS will not update until the user re-open it.
@raghavaggarwal2308 Are we sure about this? I thought it was just that the exported GlobalStore
type doesn't expose it. But I could have that incorrect
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.
@mickmister Yes we are sure, the field does not exist in redux in the latest version.
@ayusht2810 has QA done any testing on this PR? It is quite large to merge without some testing. |
@wiggin77 We generally assign a PR for QA once the PR is dev approved. If the changes looks good to you we can assign it to @AayushChaudhary0001 |
Dismissing my request for review since I think I was just added to this PR to answer a question, and there's enough other devs assigned at the moment. I've been a bit swamped with big PRs to review recently, but feel free to re-add me if needed |
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.
I have tested this PR and all the basic functionalities are working fine, LGTM. Approved.
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
@wiggin77 The CI is not running on this PR. I think this might be due to an outdated branch protection rule. Can you please check the same? |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
/update-branch |
Error trying to update the PR. |
Summary
Updated plugin with respect to phase 1 upgrades
build
folder to sync with starter templatenvmrc
file and updatepackage-lock.json
file.Ticket Link