Skip to content

Commit

Permalink
Fix incorrect type being passed to NativePerformance.mark
Browse files Browse the repository at this point in the history
Summary:
Changelog: [internal]

In D64466057 / facebook@32f7b3b we accidentally modified the API of `NativePerformance.mark` (which we wanted to preserve and move the changes to `NativePerformance.markWithResult` after some iteration) to make `startTime` optional. This change isn't OTA safe and no automated systems caught this problem.

This fixes the issue by reverting the type back to being required and always passing it from the JS API.

Differential Revision: D64557467
  • Loading branch information
rubennorte authored and facebook-github-bot committed Oct 17, 2024
1 parent d11954e commit 39b4cdd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export default class Performance {
markOptions?.startTime,
);
} else if (NativePerformance?.mark) {
NativePerformance.mark(markName, markOptions?.startTime);
computedStartTime = markOptions?.startTime ?? performance.now();
NativePerformance?.mark?.(markName, computedStartTime);
} else {
warnNoNativePerformance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type PerformanceObserverInit = {
export interface Spec extends TurboModule {
+now?: () => number;
// TODO: remove when `markWithResult` is fully rolled out.
+mark?: (name: string, startTime?: number) => void;
+mark?: (name: string, startTime: number) => void;
// TODO: remove when `measureWithResult` is fully rolled out.
+measure?: (
name: string,
Expand Down

0 comments on commit 39b4cdd

Please sign in to comment.