Assembly view#4196
Conversation
73a6e63 to
a43e133
Compare
a43e133 to
8890fa6
Compare
8890fa6 to
ceef35a
Compare
7109700 to
e4409d8
Compare
292be1e to
f76542a
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #4196 +/- ##
==========================================
+ Coverage 88.48% 88.62% +0.14%
==========================================
Files 287 293 +6
Lines 25807 25980 +173
Branches 6946 6998 +52
==========================================
+ Hits 22836 23026 +190
+ Misses 2765 2748 -17
Partials 206 206
... and 6 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
c50b601 to
dd7eaa2
Compare
dd7eaa2 to
b334336
Compare
b334336 to
6d75828
Compare
57ee618 to
63e0ef5
Compare
|
This is now ready for review! |
canova
left a comment
There was a problem hiding this comment.
Looks great to me! Thanks for the work, it's really exciting to have the assembly view!
| .CodeLoadingOverlay, | ||
| .SourceCodeErrorOverlay { |
There was a problem hiding this comment.
nit: Are the uppercase first letters on these class names on this file intentional or artifact of some find/replace? If I'm not mistaken, we usually use camelCase for class names. I would prefer to keep using the same styling if it wasn't intentional.
There was a problem hiding this comment.
Ah, they were somewhat intentional because I thought I remembered seeing this form elsewhere, but I must have imagined it. I'll change it to camelCase for consistency. Though we do seem to be a bit unsure about whether to use camelCase or kebab-case, I can find recent examples for both.
There was a problem hiding this comment.
Yeah, we should fix those inconsistencies as well. I mostly see kebab-case on class names that are related to photon like photon-button. Maybe they were imported directly from photon?
But there are also class names that are not tied to photon too.
There was a problem hiding this comment.
My (non explicit) styleguide was that I used kebab-case for project-transverse styles (such as photon but not only), and camelCase (like it was before) for component-specific styles. TBH I would prefer with the uppercase first letters for these ones because then it's more obvious they're tied to a component.
| background-color: var(--grey-30) !important; | ||
| } | ||
|
|
||
| /* Provide 3px extra grabbable surface on each side of the splitter */ |
There was a problem hiding this comment.
When you start dragging that extra 3px grabbable area, the splitter jumps because of it. But probably that's not a big issue.
There was a problem hiding this comment.
I noticed that too and filed zesik/react-splitter-layout#67 about it, but the repo seems somewhat unmaintained. It also happens with a regular wide splitter, it's not because of the negative margins, from what I can tell.
There was a problem hiding this comment.
I see, thanks for filing! Yeah, last commit is from 2019. Doesn't look like it's maintained
|
|
||
| function convertErrors(errors: ApiQueryError[]): SourceCodeLoadingError[] { | ||
| // Copy the array so that the types work out. | ||
| return errors.map((e) => e); |
There was a problem hiding this comment.
Hmm this looks a bit unnecessary. I wonder if we can let flow understand this without copying. I wanted to check it locally but looks like I need to fix my flow setup first :')
There was a problem hiding this comment.
I think it's necessary unless there's a way to tell Flow that we will not mutate the result.
If we don't copy the array here, I can see why Flow doesn't like it.
const apiErrors = [{ type: 'BROWSER_API_ERROR', apiErrorMessage: '' }];
const sourceCodeLoadingErrors = convertErrors(apiErrors);
sourceCodeLoadingErrors.push({ type: 'NO_KNOWN_CORS_URL' });
// Now apiErrors has an object in it which is not allowed by the ApiQueryError type!There was a problem hiding this comment.
I see, thanks for the explanation. That works for me then.
There was a problem hiding this comment.
@mstange This seems to work for me with a $ReadOnlyArray:
diff --git a/src/components/app/BottomBox.js b/src/components/app/BottomBox.js
index 348ecd048..27b882283 100644
--- a/src/components/app/BottomBox.js
+++ b/src/components/app/BottomBox.js
@@ -34,18 +34,16 @@ import explicitConnect from 'firefox-profiler/utils/connect';
import type { ConnectedProps } from 'firefox-profiler/utils/connect';
import type {
LineTimings,
AddressTimings,
SourceCodeStatus,
AssemblyCodeStatus,
NativeSymbolInfo,
- SourceCodeLoadingError,
- ApiQueryError,
} from 'firefox-profiler/types';
import type { CodeErrorOverlayProps } from './CodeErrorOverlay';
import { Localized } from '@fluent/react';
import './BottomBox.css';
type StateProps = {|
@@ -257,34 +255,27 @@ class BottomBoxImpl extends React.PureComponent<Props> {
/>
) : null}
{assemblyViewCode !== undefined &&
assemblyViewCode.type === 'LOADING' ? (
<CodeLoadingOverlay source={assemblyViewCode.source} />
) : null}
{assemblyViewCode !== undefined &&
assemblyViewCode.type === 'ERROR' ? (
- <AssemblyCodeErrorOverlay
- errors={convertErrors(assemblyViewCode.errors)}
- />
+ <AssemblyCodeErrorOverlay errors={assemblyViewCode.errors} />
) : null}
</div>
</div>
) : null}
</SplitterLayout>
</div>
);
}
}
-function convertErrors(errors: ApiQueryError[]): SourceCodeLoadingError[] {
- // Copy the array so that the types work out.
- return errors.map((e) => e);
-}
-
export const BottomBox = explicitConnect<{||}, StateProps, DispatchProps>({
mapStateToProps: (state) => ({
sourceViewFile: getSourceViewFile(state),
sourceViewCode: getSourceViewCode(state),
globalLineTimings: selectedThreadSelectors.getSourceViewLineTimings(state),
selectedCallNodeLineTimings:
selectedNodeSelectors.getSourceViewLineTimings(state),
sourceViewScrollGeneration: getSourceViewScrollGeneration(state),
diff --git a/src/components/app/CodeErrorOverlay.js b/src/components/app/CodeErrorOverlay.js
index f833fd19c..f647c1db9 100644
--- a/src/components/app/CodeErrorOverlay.js
+++ b/src/components/app/CodeErrorOverlay.js
@@ -5,17 +5,17 @@
import React from 'react';
import { assertExhaustiveCheck } from 'firefox-profiler/utils/flow';
import type { SourceCodeLoadingError } from 'firefox-profiler/types';
import { Localized } from '@fluent/react';
export type CodeErrorOverlayProps = {|
- errors: SourceCodeLoadingError[],
+ errors: $ReadOnlyArray<SourceCodeLoadingError>,
|};
export function CodeErrorOverlay({ errors }: CodeErrorOverlayProps) {
return (
<ul className="codeErrorOverlay">
{errors.map((error, key) => {
switch (error.type) {
case 'NO_KNOWN_CORS_URL': {Am I missing something?
There was a problem hiding this comment.
Nice! I wasn't aware of $ReadOnlyArray. I had briefly tried $ReadOnly<SourceCodeLoadingError[]> but I've never really worked with these special types and didn't check the documentation.
Do you want to submit this patch as a PR or would you like me to do it?
There was a problem hiding this comment.
I cleaned up my local copy already oops :) I'm happy if you can do it and double check that I didn't forget anything, and I can review!
This also updates some L10nIDs and some strings. In particular, it changes the string "Source not available" to "Source code not available", which is less ambiguous.
This adds an assembly view to the bottom box.
It currently works with Firefox 110+ when looking at a freshly-captured profile, but not when looking at an existing uploaded profile. To test:
devtools.performance.recording.ui-base-urlpref tohttps://deploy-preview-4196--perf-html.netlify.app/.It also works with freshly-captured profiles from samply. To test:
PROFILER_URL='https://deploy-preview-4196--perf-html.netlify.app/' samply record [...]Deploy preview