-
Notifications
You must be signed in to change notification settings - Fork 29
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
Refresh cached plots data on every update #3532
Conversation
26cb1df
to
7fe2670
Compare
7fe2670
to
e92b897
Compare
@@ -450,12 +450,6 @@ export class Experiments extends BaseRepository<TableData> { | |||
return experiment?.name || experiment?.label | |||
} | |||
|
|||
public getMutableRevisions() { |
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.
[F] No longer required as we now refresh all selected revisions all the time.
this.model.getMissingRevisions(), | ||
this.model.getMutableRevisions() | ||
) | ||
this.notifyTriggered() |
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.
[F] This is how we send the cached data before following up with a CLI update.
private onDidTriggerDataUpdate() { | ||
const sendCachedDataToWebview = () => { | ||
this.plots.resetFetched() | ||
this.plots.setComparisonOrder() |
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.
[F] Resetting the fetchedRevs means that we get spinners in the ribbon for all of the revisions. Setting the comparison order means we get a loading state for the comparison table:
Screen.Recording.2023-03-24.at.11.33.54.am.mov
@@ -355,6 +336,12 @@ export class PlotsModel extends ModelWithPersistence { | |||
return this.experiments.getSelectedRevisions().map(({ label }) => label) | |||
} | |||
|
|||
public getSelectedOrderedCliIds() { | |||
return collectOrderedRevisions(this.experiments.getSelectedRevisions()).map( |
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.
[F] This logic should give stable semantics no matter what order the user selects the experiments. We will take the most recent version of the template and try to apply that to the rest of the data.
@@ -355,6 +336,12 @@ export class PlotsModel extends ModelWithPersistence { | |||
return this.experiments.getSelectedRevisions().map(({ label }) => label) | |||
} | |||
|
|||
public getSelectedOrderedCliIds() { | |||
return collectOrderedRevisions(this.experiments.getSelectedRevisions()).map( |
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.
[F] This logic should give stable semantics no matter what order the user selects the experiments. We will take the most recent version of the template and try to apply that to the rest of the data.
ae197a0
to
a7f586f
Compare
02b01cc
to
e1519ad
Compare
a7f586f
to
e560f67
Compare
e1519ad
to
b0dd757
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.
Great work!
e560f67
to
82fa5b4
Compare
b0dd757
to
72be7b6
Compare
72be7b6
to
02e94b4
Compare
@@ -23,7 +23,7 @@ interface CustomPlotsProps { | |||
|
|||
export const CustomPlots: React.FC<CustomPlotsProps> = ({ plotsIds }) => { | |||
const [order, setOrder] = useState(plotsIds) | |||
const { nbItemsPerRow, hasData, disabledDragPlotIds } = useSelector( | |||
const { nbItemsPerRow, hasData, hasItems, disabledDragPlotIds } = useSelector( |
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.
Similar blocks of code found in 4 locations. Consider refactoring.
@@ -7,12 +7,9 @@ import { PlotsContainer } from '../PlotsContainer' | |||
import { PlotsState } from '../../store' | |||
|
|||
export const TemplatePlotsWrapper: React.FC = () => { | |||
const { nbItemsPerRow, isCollapsed, height } = useSelector( | |||
const { nbItemsPerRow, isCollapsed, height, hasItems } = useSelector( |
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.
Similar blocks of code found in 4 locations. Consider refactoring.
Code Climate has analyzed commit 02e94b4 and detected 2 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (85% is the threshold). This pull request will bring the total coverage in the repository to 95.1%. View more on Code Climate. |
4/4
main
<- #3477 <- #3520 <- #3522 <- thisCloses #2277. Patches this problem.
Tl;dr of the problem is that our cached plots data is actually mutable depending on the combination of revisions (and even order of those revisions) that we call the
plots diff
with.This PR updates the way that we treat cached plots data in the extension. Now every time there is an update to the selected revisions we call for an update from the CLI. Please watch the demo plus read below to see the approach that I've taken.
LMK what you think.
Demo
Screen.Recording.2023-03-23.at.9.37.46.pm.mov
The way that it works.
This approach gives us a few of things: