mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-25 09:46:05 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9946c2598d |
@@ -146,6 +146,22 @@ quietly relying on:
|
||||
|
||||
The fix for transforms is Gotcha 3. The fix for context is Gotcha 7.
|
||||
|
||||
### The portal patch
|
||||
|
||||
`patches/@gorhom+portal+1.0.14.patch` moves portal state out of the provider's
|
||||
context value and into a store each `PortalHost` subscribes to. Upstream keeps
|
||||
every host's portals in one context value at the app root, so each portal mount,
|
||||
update and unmount changed that value and React searched every mounted fiber
|
||||
for consumers. That cost grows with the retained panels: a hover card took
|
||||
about 3 ms of it in a fresh window and 16 ms after a few hours. With the store,
|
||||
a portal change renders only its own host.
|
||||
|
||||
Do not put per-overlay state in a context that wraps the app for the same
|
||||
reason. Give the consumers a store to subscribe to.
|
||||
|
||||
The patch also keys each portal in its host (upstream PR #62). Without the key,
|
||||
closing one overlay remounted every later overlay in the same host.
|
||||
|
||||
## Gotcha 3 — Keyboard layout and portal anchors
|
||||
|
||||
`composer/dock` owns the stationary viewport, bottom-anchored surface, composer
|
||||
|
||||
+10
-1
@@ -86,7 +86,7 @@ mounts—never at module evaluation time.
|
||||
|
||||
## Dynamic Pixel Styles On Web
|
||||
|
||||
Avoid feeding changing pixel values such as `{ top, left }`, `{ maxHeight }`, or `{ minWidth }` into the `style` prop of Unistyles-managed React Native components on web. The web runtime hashes each distinct style object by value and appends a CSS rule to `#unistyles-web`; those rules are not reclaimed during the page lifetime, so pointer-driven positioning can turn into steady stylesheet growth.
|
||||
Avoid feeding changing pixel values such as `{ top, left }`, `{ maxHeight }`, or `{ minWidth }` into the `style` prop of Unistyles-managed React Native components on web. The web runtime hashes each distinct style object by value and inserts a CSS rule into `#unistyles-web` for it, then deletes the rule when the last element using it unmounts. Pointer-driven positioning turns into a rule insert and delete per move.
|
||||
|
||||
Use the inline style escape hatch below for high-churn values. Do not split a component into plain/web/native variants just to keep one measured value out of the CSS registry. Raw DOM wrappers are reserved for real DOM infrastructure, such as terminal hosts, virtualized web rows, or third-party drag wrappers.
|
||||
|
||||
@@ -224,6 +224,7 @@ Quick confirmation in DevTools console:
|
||||
```js
|
||||
[...document.styleSheets]
|
||||
.flatMap((s) => [...(s.cssRules || [])])
|
||||
.flatMap((r) => (r.cssRules ? [...r.cssRules] : [r]))
|
||||
.map((r) => r.cssText)
|
||||
.filter((t) => t.includes("unistyles") && t.includes("> *"));
|
||||
```
|
||||
@@ -366,6 +367,14 @@ colors. Keep this patch until upstream reads the scheme through separate lists.
|
||||
The desktop browser E2E checks both transition directions in an isolated Electron
|
||||
process, because Playwright's focus emulation prevents real hidden-page behavior.
|
||||
|
||||
The stylesheet patch backports upstream PR #1354 (3.8.0). Unistyles 3.2.4 rewrote
|
||||
the whole text of `#unistyles-web` whenever a class was added or removed, and
|
||||
the browser then restyled the entire document: about 5 ms each time, several
|
||||
times for one hover card. The backport changes one CSSOM rule per class instead.
|
||||
The tag therefore has no text; read its rules through `sheet.cssRules`. Classes
|
||||
without a media query sit inside an `@media all` group. Assert on the stylesheet
|
||||
in E2E with `packages/app/e2e/support/helpers/shared-stylesheet.ts`.
|
||||
|
||||
Register every dependency patch in `scripts/postinstall-patches.mjs`. A file in
|
||||
`patches/` is inert unless that script knows which installed package activates
|
||||
it.
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { test, expect } from "../support/fixtures";
|
||||
import { runWorkspaceActionFromCommandCenter } from "../support/helpers/command-center-workspace-actions";
|
||||
|
||||
interface DragMeasurement {
|
||||
observer: MutationObserver;
|
||||
stylesheetMutations: number;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__PASEO_EXPLORER_DRAG_MEASUREMENT__?: DragMeasurement;
|
||||
}
|
||||
}
|
||||
import {
|
||||
readSharedStylesheetChanges,
|
||||
rememberSharedStylesheet,
|
||||
} from "../support/helpers/shared-stylesheet";
|
||||
|
||||
async function waitForResizePaint(page: Page): Promise<void> {
|
||||
await page.evaluate(
|
||||
@@ -23,23 +16,8 @@ async function waitForResizePaint(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
async function beginResizeMeasurement(page: Page): Promise<void> {
|
||||
await page.evaluate(() => {
|
||||
const stylesheet = document.getElementById("unistyles-web");
|
||||
if (!stylesheet) throw new Error("Shared stylesheet is missing");
|
||||
globalThis.__PASEO_RESET_RENDER_PROFILE__!();
|
||||
const measurement: DragMeasurement = {
|
||||
stylesheetMutations: 0,
|
||||
observer: new MutationObserver((records) => {
|
||||
measurement.stylesheetMutations += records.length;
|
||||
}),
|
||||
};
|
||||
measurement.observer.observe(stylesheet, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
window.__PASEO_EXPLORER_DRAG_MEASUREMENT__ = measurement;
|
||||
});
|
||||
await page.evaluate(() => globalThis.__PASEO_RESET_RENDER_PROFILE__!());
|
||||
await rememberSharedStylesheet(page);
|
||||
}
|
||||
|
||||
async function previewExplorerResize(page: Page, distance: number) {
|
||||
@@ -61,16 +39,14 @@ async function previewExplorerResize(page: Page, distance: number) {
|
||||
await waitForResizePaint(page);
|
||||
}
|
||||
const during = (await explorer.boundingBox())!.width;
|
||||
const measurement = await page.evaluate(() => {
|
||||
const state = window.__PASEO_EXPLORER_DRAG_MEASUREMENT__!;
|
||||
state.observer.disconnect();
|
||||
return {
|
||||
stylesheetMutations: state.stylesheetMutations,
|
||||
paneRenders: Object.entries(globalThis.__PASEO_RENDER_PROFILE_REASONS__ ?? {})
|
||||
const measurement = {
|
||||
stylesheetChanges: await readSharedStylesheetChanges(page),
|
||||
paneRenders: await page.evaluate(() =>
|
||||
Object.entries(globalThis.__PASEO_RENDER_PROFILE_REASONS__ ?? {})
|
||||
.filter(([id]) => id.startsWith("SplitPaneView:"))
|
||||
.reduce((sum, [, reasons]) => sum + (reasons.render ?? 0), 0),
|
||||
};
|
||||
});
|
||||
),
|
||||
};
|
||||
await page.mouse.up();
|
||||
await waitForResizePaint(page);
|
||||
const after = (await explorer.boundingBox())!.width;
|
||||
@@ -92,7 +68,7 @@ async function expectExplorerWidthSurvivesReload(page: Page, width: number): Pro
|
||||
await expect.poll(async () => (await explorer.boundingBox())?.width).toBeCloseTo(width, 0);
|
||||
}
|
||||
|
||||
test("Explorer drag previews without rerendering panes or rewriting the shared stylesheet", async ({
|
||||
test("Explorer drag previews without rerendering panes or changing the shared stylesheet", async ({
|
||||
page,
|
||||
withWorkspace,
|
||||
}) => {
|
||||
@@ -117,9 +93,9 @@ test("Explorer drag previews without rerendering panes or rewriting the shared s
|
||||
).toBe(true);
|
||||
const grown = await previewExplorerResize(page, -100);
|
||||
const shrunk = await previewExplorerResize(page, 50);
|
||||
expect(grown.stylesheetMutations).toBe(0);
|
||||
expect(grown.stylesheetChanges).toEqual({ added: 0, removed: 0, rebuilt: 0 });
|
||||
expect(grown.paneRenders).toBe(0);
|
||||
expect(shrunk.stylesheetMutations).toBe(0);
|
||||
expect(shrunk.stylesheetChanges).toEqual({ added: 0, removed: 0, rebuilt: 0 });
|
||||
expect(shrunk.paneRenders).toBe(0);
|
||||
await expectExplorerWidthSurvivesReload(page, shrunk.width);
|
||||
});
|
||||
|
||||
@@ -25,6 +25,10 @@ import { projectEquivalenceViewKey } from "../support/helpers/project-view-key";
|
||||
import { escapeRegex } from "../support/helpers/regex";
|
||||
import { openFilesPanel } from "../support/helpers/workspace-tabs";
|
||||
import { seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||
import {
|
||||
readSharedStylesheetChanges,
|
||||
rememberSharedStylesheet,
|
||||
} from "../support/helpers/shared-stylesheet";
|
||||
|
||||
const GITHUB_REMOTE_URL = "https://github.com/test-owner/test-repo.git";
|
||||
|
||||
@@ -429,6 +433,32 @@ test.describe("Sidebar workspace list", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("workspace hover card opens and closes without rebuilding the shared stylesheet", async ({
|
||||
page,
|
||||
}) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "sidebar-hover-stylesheet-" });
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await waitForSidebarProject(page, path.basename(workspace.repoPath));
|
||||
await movePointerAwayFromWorkspaceHoverCard(page);
|
||||
await rememberSharedStylesheet(page);
|
||||
|
||||
await openWorkspaceHoverCard(page, workspace.workspaceId);
|
||||
const opened = await readSharedStylesheetChanges(page);
|
||||
// The card brings styles nothing else on screen uses, so the stylesheet has to grow.
|
||||
expect(opened.added).toBeGreaterThan(0);
|
||||
expect(opened.rebuilt).toBe(0);
|
||||
|
||||
await rememberSharedStylesheet(page);
|
||||
await movePointerAwayFromWorkspaceHoverCard(page);
|
||||
await expectWorkspaceHoverCardClosed(page);
|
||||
expect((await readSharedStylesheetChanges(page)).rebuilt).toBe(0);
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("workspace hover card closes when the pointer leaves a clicked row", async ({ page }) => {
|
||||
const workspace = await seedWorkspace({ repoPrefix: "sidebar-hover-click-leave-" });
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
|
||||
/**
|
||||
* The shared stylesheet is `#unistyles-web`: one rule per generated style class, for the whole app.
|
||||
* Replacing a rule that is still in use makes the browser restyle the entire document, so a spec
|
||||
* remembers the rules, performs an interaction, and reads back what happened to them.
|
||||
*/
|
||||
export interface SharedStylesheetChanges {
|
||||
/** Rules for classes the interaction introduced. */
|
||||
added: number;
|
||||
/** Rules for classes nothing uses any more. */
|
||||
removed: number;
|
||||
/** Rules still in use that were thrown away and created again. */
|
||||
rebuilt: number;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__PASEO_SHARED_STYLESHEET_RULES__?: Map<string, CSSRule>;
|
||||
}
|
||||
}
|
||||
|
||||
function readSharedStylesheetRules(): Map<string, CSSRule> {
|
||||
const tag = document.getElementById("unistyles-web");
|
||||
if (!(tag instanceof HTMLStyleElement) || !tag.sheet) {
|
||||
throw new Error("Shared stylesheet is missing");
|
||||
}
|
||||
const rules = new Map<string, CSSRule>();
|
||||
const collect = (list: CSSRuleList, group: string) => {
|
||||
for (const rule of list) {
|
||||
if (rule instanceof CSSStyleRule) rules.set(`${group}${rule.selectorText}`, rule);
|
||||
else if (rule instanceof CSSMediaRule) collect(rule.cssRules, `${rule.conditionText} `);
|
||||
}
|
||||
};
|
||||
collect(tag.sheet.cssRules, "");
|
||||
return rules;
|
||||
}
|
||||
|
||||
export async function rememberSharedStylesheet(page: Page): Promise<void> {
|
||||
await page.evaluate(
|
||||
`window.__PASEO_SHARED_STYLESHEET_RULES__ = (${readSharedStylesheetRules.toString()})()`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function readSharedStylesheetChanges(page: Page): Promise<SharedStylesheetChanges> {
|
||||
return page.evaluate(`(() => {
|
||||
const before = window.__PASEO_SHARED_STYLESHEET_RULES__;
|
||||
if (!before) throw new Error("Shared stylesheet was not remembered");
|
||||
const after = (${readSharedStylesheetRules.toString()})();
|
||||
const changes = { added: 0, removed: 0, rebuilt: 0 };
|
||||
for (const [selector, rule] of after) {
|
||||
if (!before.has(selector)) changes.added += 1;
|
||||
else if (before.get(selector) !== rule) changes.rebuilt += 1;
|
||||
}
|
||||
for (const selector of before.keys()) {
|
||||
if (!after.has(selector)) changes.removed += 1;
|
||||
}
|
||||
return changes;
|
||||
})()`);
|
||||
}
|
||||
@@ -1,15 +1,27 @@
|
||||
import React, { act } from "react";
|
||||
import React, { act, Profiler, useEffect, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { Portal, PortalProvider } from "@gorhom/portal";
|
||||
import { Portal, PortalHost, PortalProvider } from "@gorhom/portal";
|
||||
import { FloatingPanelPortalHost, measureFloatingPanelPortalHost } from "./floating-panel-portal";
|
||||
|
||||
async function mount(element: React.ReactElement) {
|
||||
const container = document.createElement("div");
|
||||
container.style.cssText = "position:relative;width:800px;height:600px";
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
await act(async () => root.render(element));
|
||||
return {
|
||||
container,
|
||||
render: (next: React.ReactElement) => act(async () => root.render(next)),
|
||||
unmount: async () => {
|
||||
await act(async () => root.unmount());
|
||||
container.remove();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("Floating panel host lifetime", () => {
|
||||
test("removing the newest host preserves the surviving host measurement", async () => {
|
||||
const container = document.createElement("div");
|
||||
container.style.cssText = "position:relative;width:800px;height:600px";
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
function Content({ overlap }: { overlap: boolean }) {
|
||||
return (
|
||||
<PortalProvider shouldAddRootHost={false}>
|
||||
@@ -21,20 +33,106 @@ describe("Floating panel host lifetime", () => {
|
||||
</PortalProvider>
|
||||
);
|
||||
}
|
||||
const view = await mount(<Content overlap={true} />);
|
||||
try {
|
||||
await act(async () => root.render(<Content overlap={true} />));
|
||||
expect(await measureFloatingPanelPortalHost("workspace")).toMatchObject({
|
||||
width: 800,
|
||||
height: 600,
|
||||
});
|
||||
await act(async () => root.render(<Content overlap={false} />));
|
||||
await view.render(<Content overlap={false} />);
|
||||
expect(await measureFloatingPanelPortalHost("workspace")).toMatchObject({
|
||||
width: 800,
|
||||
height: 600,
|
||||
});
|
||||
} finally {
|
||||
await act(async () => root.unmount());
|
||||
container.remove();
|
||||
await view.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const rendered: string[] = [];
|
||||
|
||||
function record(id: string) {
|
||||
rendered.push(id);
|
||||
}
|
||||
|
||||
describe("Portal hosts", () => {
|
||||
test("opening a portal renders its own host and no other", async () => {
|
||||
let setCardOpen: (open: boolean) => void = () => {};
|
||||
function Card() {
|
||||
const [open, setOpen] = useState(false);
|
||||
setCardOpen = setOpen;
|
||||
if (!open) return null;
|
||||
return (
|
||||
<Portal hostName="sidebar" name="card">
|
||||
<div data-testid="card">Workspace</div>
|
||||
</Portal>
|
||||
);
|
||||
}
|
||||
const view = await mount(
|
||||
<PortalProvider shouldAddRootHost={false}>
|
||||
<Profiler id="sidebar" onRender={record}>
|
||||
<PortalHost name="sidebar" />
|
||||
</Profiler>
|
||||
<Profiler id="workspace" onRender={record}>
|
||||
<PortalHost name="workspace" />
|
||||
</Profiler>
|
||||
<Card />
|
||||
</PortalProvider>,
|
||||
);
|
||||
try {
|
||||
rendered.length = 0;
|
||||
await act(async () => setCardOpen(true));
|
||||
|
||||
expect(view.container.querySelector('[data-testid="card"]')?.textContent).toBe("Workspace");
|
||||
expect(rendered).toContain("sidebar");
|
||||
expect(rendered).not.toContain("workspace");
|
||||
|
||||
rendered.length = 0;
|
||||
await act(async () => setCardOpen(false));
|
||||
|
||||
expect(view.container.querySelector('[data-testid="card"]')).toBeNull();
|
||||
expect(rendered).not.toContain("workspace");
|
||||
} finally {
|
||||
await view.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
test("closing an earlier portal keeps a later portal mounted", async () => {
|
||||
let menuMounts = 0;
|
||||
function Menu() {
|
||||
useEffect(() => {
|
||||
menuMounts += 1;
|
||||
}, []);
|
||||
return <div data-testid="menu">Menu</div>;
|
||||
}
|
||||
function Content({ tooltip }: { tooltip: boolean }) {
|
||||
return (
|
||||
<PortalProvider shouldAddRootHost={false}>
|
||||
<PortalHost name="workspace" />
|
||||
{tooltip && (
|
||||
<Portal hostName="workspace" name="tooltip">
|
||||
<span data-testid="tooltip">Tooltip</span>
|
||||
</Portal>
|
||||
)}
|
||||
<Portal hostName="workspace" name="menu">
|
||||
<Menu />
|
||||
</Portal>
|
||||
</PortalProvider>
|
||||
);
|
||||
}
|
||||
const view = await mount(<Content tooltip={true} />);
|
||||
try {
|
||||
expect(view.container.querySelector('[data-testid="tooltip"]')).not.toBeNull();
|
||||
expect(menuMounts).toBe(1);
|
||||
|
||||
await view.render(<Content tooltip={false} />);
|
||||
|
||||
expect(view.container.querySelector('[data-testid="tooltip"]')).toBeNull();
|
||||
expect(view.container.querySelector('[data-testid="menu"]')).not.toBeNull();
|
||||
expect(menuMounts).toBe(1);
|
||||
} finally {
|
||||
await view.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import React, { act, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
let setLabel: (label: string) => void = () => {};
|
||||
|
||||
function Row({ label }: { label: string }) {
|
||||
return <div>{label}</div>;
|
||||
}
|
||||
|
||||
function List() {
|
||||
const [label, setState] = useState("first");
|
||||
setLabel = setState;
|
||||
return <Row label={label} />;
|
||||
}
|
||||
|
||||
function reactMeasures(): PerformanceEntry[] {
|
||||
return performance
|
||||
.getEntriesByType("measure")
|
||||
.filter((entry) => JSON.stringify((entry as PerformanceMeasure).detail ?? "").includes("⚛"));
|
||||
}
|
||||
|
||||
// React's development build reports renders to the browser's performance timeline. The browser
|
||||
// keeps every measure for the life of the page, so a long session held millions of them.
|
||||
test("React's development render timings do not pile up in the performance timeline", async () => {
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
try {
|
||||
await act(async () => root.render(<List />));
|
||||
for (const label of ["second", "third", "fourth"]) {
|
||||
await act(async () => setLabel(label));
|
||||
}
|
||||
|
||||
expect(container.textContent).toBe("fourth");
|
||||
expect(reactMeasures()).toHaveLength(0);
|
||||
} finally {
|
||||
await act(async () => root.unmount());
|
||||
container.remove();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,468 @@
|
||||
diff --git a/node_modules/@gorhom/portal/lib/commonjs/components/portalHost/PortalHost.js b/node_modules/@gorhom/portal/lib/commonjs/components/portalHost/PortalHost.js
|
||||
index 72ba2a7..e2f32a5 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/commonjs/components/portalHost/PortalHost.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/commonjs/components/portalHost/PortalHost.js
|
||||
@@ -34,7 +34,11 @@ const PortalHostComponent = ({
|
||||
}, []); //#endregion
|
||||
//#region render
|
||||
|
||||
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, state.map(item => item.node)); //#endregion
|
||||
+ // Backport of https://github.com/gorhom/react-native-portal/pull/62: without a key, removing a
|
||||
+ // portal shifts the ones after it and React remounts them.
|
||||
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, state.map(item => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
||||
+ key: item.name
|
||||
+ }, item.node))); //#endregion
|
||||
};
|
||||
|
||||
const PortalHost = /*#__PURE__*/(0, _react.memo)(PortalHostComponent);
|
||||
diff --git a/node_modules/@gorhom/portal/lib/commonjs/components/portalProvider/PortalProvider.js b/node_modules/@gorhom/portal/lib/commonjs/components/portalProvider/PortalProvider.js
|
||||
index 3b2a494..af6616e 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/commonjs/components/portalProvider/PortalProvider.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/commonjs/components/portalProvider/PortalProvider.js
|
||||
@@ -11,9 +11,7 @@ var _PortalHost = require("../portalHost/PortalHost");
|
||||
|
||||
var _portal = require("../../contexts/portal");
|
||||
|
||||
-var _constants = require("../../state/constants");
|
||||
-
|
||||
-var _reducer = require("../../state/reducer");
|
||||
+var _store = require("../../state/store");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
@@ -24,11 +22,11 @@ const PortalProviderComponent = ({
|
||||
shouldAddRootHost = true,
|
||||
children
|
||||
}) => {
|
||||
- const [state, dispatch] = (0, _react.useReducer)(_reducer.reducer, _constants.INITIAL_STATE);
|
||||
+ const [store] = (0, _react.useState)(_store.createPortalStore);
|
||||
return /*#__PURE__*/_react.default.createElement(_portal.PortalDispatchContext.Provider, {
|
||||
- value: dispatch
|
||||
+ value: store.dispatch
|
||||
}, /*#__PURE__*/_react.default.createElement(_portal.PortalStateContext.Provider, {
|
||||
- value: state
|
||||
+ value: store
|
||||
}, children, shouldAddRootHost && /*#__PURE__*/_react.default.createElement(_PortalHost.PortalHost, {
|
||||
name: rootHostName
|
||||
})));
|
||||
diff --git a/node_modules/@gorhom/portal/lib/commonjs/hooks/usePortalState.js b/node_modules/@gorhom/portal/lib/commonjs/hooks/usePortalState.js
|
||||
index 7a18089..77a8e24 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/commonjs/hooks/usePortalState.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/commonjs/hooks/usePortalState.js
|
||||
@@ -10,13 +10,15 @@ var _react = require("react");
|
||||
var _portal = require("../contexts/portal");
|
||||
|
||||
const usePortalState = hostName => {
|
||||
- const state = (0, _react.useContext)(_portal.PortalStateContext);
|
||||
+ const store = (0, _react.useContext)(_portal.PortalStateContext);
|
||||
|
||||
- if (state === null) {
|
||||
+ if (store === null) {
|
||||
throw new Error("'PortalStateContext' cannot be null, please add 'PortalProvider' to the root component.");
|
||||
}
|
||||
|
||||
- return state[hostName] || [];
|
||||
+ const getPortals = () => store.getPortals(hostName);
|
||||
+
|
||||
+ return (0, _react.useSyncExternalStore)(store.subscribe, getPortals, getPortals);
|
||||
};
|
||||
|
||||
exports.usePortalState = usePortalState;
|
||||
diff --git a/node_modules/@gorhom/portal/lib/commonjs/state/reducer.js b/node_modules/@gorhom/portal/lib/commonjs/state/reducer.js
|
||||
index 158e729..cd50661 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/commonjs/state/reducer.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/commonjs/state/reducer.js
|
||||
@@ -31,17 +31,15 @@ const addUpdatePortal = (state, hostName, portalName, node) => {
|
||||
*/
|
||||
|
||||
|
||||
- const index = state[hostName].findIndex(item => item.name === portalName);
|
||||
-
|
||||
- if (index !== -1) {
|
||||
- state[hostName][index].node = node;
|
||||
- } else {
|
||||
- state[hostName].push({
|
||||
- name: portalName,
|
||||
- node
|
||||
- });
|
||||
- }
|
||||
-
|
||||
+ // Paseo patch: a changed host gets a new array, so the store can hand each host its own
|
||||
+ // snapshot and only the host whose portals changed renders.
|
||||
+ const portals = state[hostName];
|
||||
+ const index = portals.findIndex(item => item.name === portalName);
|
||||
+ const portal = {
|
||||
+ name: portalName,
|
||||
+ node
|
||||
+ };
|
||||
+ state[hostName] = index !== -1 ? portals.map(item => item.name === portalName ? portal : item) : [...portals, portal];
|
||||
return state;
|
||||
};
|
||||
|
||||
@@ -56,7 +54,11 @@ const removePortal = (state, hostName, portalName) => {
|
||||
}
|
||||
|
||||
const index = state[hostName].findIndex(item => item.name === portalName);
|
||||
- if (index !== -1) state[hostName].splice(index, 1);
|
||||
+
|
||||
+ if (index !== -1) {
|
||||
+ state[hostName] = state[hostName].filter(item => item.name !== portalName);
|
||||
+ }
|
||||
+
|
||||
return state;
|
||||
};
|
||||
|
||||
diff --git a/node_modules/@gorhom/portal/lib/commonjs/state/store.js b/node_modules/@gorhom/portal/lib/commonjs/state/store.js
|
||||
new file mode 100644
|
||||
index 0000000..0da9a5c
|
||||
--- /dev/null
|
||||
+++ b/node_modules/@gorhom/portal/lib/commonjs/state/store.js
|
||||
@@ -0,0 +1,34 @@
|
||||
+"use strict";
|
||||
+
|
||||
+Object.defineProperty(exports, "__esModule", {
|
||||
+ value: true
|
||||
+});
|
||||
+exports.createPortalStore = void 0;
|
||||
+
|
||||
+var _constants = require("./constants");
|
||||
+
|
||||
+var _reducer = require("./reducer");
|
||||
+
|
||||
+const NO_PORTALS = [];
|
||||
+// Paseo patch: portal state lives in a store, outside React state. Held in the provider's context
|
||||
+// value it changed on every portal add, update and remove, and React then walked every fiber under
|
||||
+// the provider (the whole app) to find the hosts consuming it. Hosts subscribe here instead.
|
||||
+const createPortalStore = () => {
|
||||
+ let state = _constants.INITIAL_STATE;
|
||||
+ const listeners = new Set();
|
||||
+ return {
|
||||
+ getPortals: hostName => state[hostName] || NO_PORTALS,
|
||||
+ dispatch: action => {
|
||||
+ state = (0, _reducer.reducer)(state, action);
|
||||
+ listeners.forEach(listener => listener());
|
||||
+ },
|
||||
+ subscribe: listener => {
|
||||
+ listeners.add(listener);
|
||||
+ return () => {
|
||||
+ listeners.delete(listener);
|
||||
+ };
|
||||
+ }
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+exports.createPortalStore = createPortalStore;
|
||||
diff --git a/node_modules/@gorhom/portal/lib/module/components/portalHost/PortalHost.js b/node_modules/@gorhom/portal/lib/module/components/portalHost/PortalHost.js
|
||||
index d22cc16..e492b4b 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/module/components/portalHost/PortalHost.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/module/components/portalHost/PortalHost.js
|
||||
@@ -21,7 +21,11 @@ const PortalHostComponent = ({
|
||||
}, []); //#endregion
|
||||
//#region render
|
||||
|
||||
- return /*#__PURE__*/React.createElement(React.Fragment, null, state.map(item => item.node)); //#endregion
|
||||
+ // Backport of https://github.com/gorhom/react-native-portal/pull/62: without a key, removing a
|
||||
+ // portal shifts the ones after it and React remounts them.
|
||||
+ return /*#__PURE__*/React.createElement(React.Fragment, null, state.map(item => /*#__PURE__*/React.createElement(React.Fragment, {
|
||||
+ key: item.name
|
||||
+ }, item.node))); //#endregion
|
||||
};
|
||||
|
||||
export const PortalHost = /*#__PURE__*/memo(PortalHostComponent);
|
||||
diff --git a/node_modules/@gorhom/portal/lib/module/components/portalProvider/PortalProvider.js b/node_modules/@gorhom/portal/lib/module/components/portalProvider/PortalProvider.js
|
||||
index 522a08a..d2e07b6 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/module/components/portalProvider/PortalProvider.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/module/components/portalProvider/PortalProvider.js
|
||||
@@ -1,19 +1,18 @@
|
||||
-import React, { memo, useReducer } from 'react';
|
||||
+import React, { memo, useState } from 'react';
|
||||
import { PortalHost } from '../portalHost/PortalHost';
|
||||
import { PortalDispatchContext, PortalStateContext } from '../../contexts/portal';
|
||||
-import { INITIAL_STATE } from '../../state/constants';
|
||||
-import { reducer } from '../../state/reducer';
|
||||
+import { createPortalStore } from '../../state/store';
|
||||
|
||||
const PortalProviderComponent = ({
|
||||
rootHostName = 'root',
|
||||
shouldAddRootHost = true,
|
||||
children
|
||||
}) => {
|
||||
- const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
|
||||
+ const [store] = useState(createPortalStore);
|
||||
return /*#__PURE__*/React.createElement(PortalDispatchContext.Provider, {
|
||||
- value: dispatch
|
||||
+ value: store.dispatch
|
||||
}, /*#__PURE__*/React.createElement(PortalStateContext.Provider, {
|
||||
- value: state
|
||||
+ value: store
|
||||
}, children, shouldAddRootHost && /*#__PURE__*/React.createElement(PortalHost, {
|
||||
name: rootHostName
|
||||
})));
|
||||
diff --git a/node_modules/@gorhom/portal/lib/module/hooks/usePortalState.js b/node_modules/@gorhom/portal/lib/module/hooks/usePortalState.js
|
||||
index c82cc71..daee3ac 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/module/hooks/usePortalState.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/module/hooks/usePortalState.js
|
||||
@@ -1,12 +1,14 @@
|
||||
-import { useContext } from 'react';
|
||||
+import { useContext, useSyncExternalStore } from 'react';
|
||||
import { PortalStateContext } from '../contexts/portal';
|
||||
export const usePortalState = hostName => {
|
||||
- const state = useContext(PortalStateContext);
|
||||
+ const store = useContext(PortalStateContext);
|
||||
|
||||
- if (state === null) {
|
||||
+ if (store === null) {
|
||||
throw new Error("'PortalStateContext' cannot be null, please add 'PortalProvider' to the root component.");
|
||||
}
|
||||
|
||||
- return state[hostName] || [];
|
||||
+ const getPortals = () => store.getPortals(hostName);
|
||||
+
|
||||
+ return useSyncExternalStore(store.subscribe, getPortals, getPortals);
|
||||
};
|
||||
//# sourceMappingURL=usePortalState.js.map
|
||||
\ No newline at end of file
|
||||
diff --git a/node_modules/@gorhom/portal/lib/module/state/reducer.js b/node_modules/@gorhom/portal/lib/module/state/reducer.js
|
||||
index cad5f28..51f7124 100644
|
||||
--- a/node_modules/@gorhom/portal/lib/module/state/reducer.js
|
||||
+++ b/node_modules/@gorhom/portal/lib/module/state/reducer.js
|
||||
@@ -23,17 +23,15 @@ const addUpdatePortal = (state, hostName, portalName, node) => {
|
||||
*/
|
||||
|
||||
|
||||
- const index = state[hostName].findIndex(item => item.name === portalName);
|
||||
-
|
||||
- if (index !== -1) {
|
||||
- state[hostName][index].node = node;
|
||||
- } else {
|
||||
- state[hostName].push({
|
||||
- name: portalName,
|
||||
- node
|
||||
- });
|
||||
- }
|
||||
-
|
||||
+ // Paseo patch: a changed host gets a new array, so the store can hand each host its own
|
||||
+ // snapshot and only the host whose portals changed renders.
|
||||
+ const portals = state[hostName];
|
||||
+ const index = portals.findIndex(item => item.name === portalName);
|
||||
+ const portal = {
|
||||
+ name: portalName,
|
||||
+ node
|
||||
+ };
|
||||
+ state[hostName] = index !== -1 ? portals.map(item => item.name === portalName ? portal : item) : [...portals, portal];
|
||||
return state;
|
||||
};
|
||||
|
||||
@@ -48,7 +46,11 @@ const removePortal = (state, hostName, portalName) => {
|
||||
}
|
||||
|
||||
const index = state[hostName].findIndex(item => item.name === portalName);
|
||||
- if (index !== -1) state[hostName].splice(index, 1);
|
||||
+
|
||||
+ if (index !== -1) {
|
||||
+ state[hostName] = state[hostName].filter(item => item.name !== portalName);
|
||||
+ }
|
||||
+
|
||||
return state;
|
||||
};
|
||||
|
||||
diff --git a/node_modules/@gorhom/portal/lib/module/state/store.js b/node_modules/@gorhom/portal/lib/module/state/store.js
|
||||
new file mode 100644
|
||||
index 0000000..2c94075
|
||||
--- /dev/null
|
||||
+++ b/node_modules/@gorhom/portal/lib/module/state/store.js
|
||||
@@ -0,0 +1,23 @@
|
||||
+import { INITIAL_STATE } from './constants';
|
||||
+import { reducer } from './reducer';
|
||||
+const NO_PORTALS = [];
|
||||
+// Paseo patch: portal state lives in a store, outside React state. Held in the provider's context
|
||||
+// value it changed on every portal add, update and remove, and React then walked every fiber under
|
||||
+// the provider (the whole app) to find the hosts consuming it. Hosts subscribe here instead.
|
||||
+export const createPortalStore = () => {
|
||||
+ let state = INITIAL_STATE;
|
||||
+ const listeners = new Set();
|
||||
+ return {
|
||||
+ getPortals: hostName => state[hostName] || NO_PORTALS,
|
||||
+ dispatch: action => {
|
||||
+ state = reducer(state, action);
|
||||
+ listeners.forEach(listener => listener());
|
||||
+ },
|
||||
+ subscribe: listener => {
|
||||
+ listeners.add(listener);
|
||||
+ return () => {
|
||||
+ listeners.delete(listener);
|
||||
+ };
|
||||
+ }
|
||||
+ };
|
||||
+};
|
||||
diff --git a/node_modules/@gorhom/portal/src/components/portalHost/PortalHost.tsx b/node_modules/@gorhom/portal/src/components/portalHost/PortalHost.tsx
|
||||
index 62a2103..699765e 100644
|
||||
--- a/node_modules/@gorhom/portal/src/components/portalHost/PortalHost.tsx
|
||||
+++ b/node_modules/@gorhom/portal/src/components/portalHost/PortalHost.tsx
|
||||
@@ -20,7 +20,15 @@ const PortalHostComponent = ({ name }: PortalHostProps) => {
|
||||
//#endregion
|
||||
|
||||
//#region render
|
||||
- return <>{state.map(item => item.node)}</>;
|
||||
+ // Backport of https://github.com/gorhom/react-native-portal/pull/62: without a key, removing a
|
||||
+ // portal shifts the ones after it and React remounts them.
|
||||
+ return (
|
||||
+ <>
|
||||
+ {state.map(item => (
|
||||
+ <React.Fragment key={item.name}>{item.node}</React.Fragment>
|
||||
+ ))}
|
||||
+ </>
|
||||
+ );
|
||||
//#endregion
|
||||
};
|
||||
|
||||
diff --git a/node_modules/@gorhom/portal/src/components/portalProvider/PortalProvider.tsx b/node_modules/@gorhom/portal/src/components/portalProvider/PortalProvider.tsx
|
||||
index 8350171..f91273a 100644
|
||||
--- a/node_modules/@gorhom/portal/src/components/portalProvider/PortalProvider.tsx
|
||||
+++ b/node_modules/@gorhom/portal/src/components/portalProvider/PortalProvider.tsx
|
||||
@@ -1,11 +1,10 @@
|
||||
-import React, { memo, useReducer } from 'react';
|
||||
+import React, { memo, useState } from 'react';
|
||||
import { PortalHost } from '../portalHost/PortalHost';
|
||||
import {
|
||||
PortalDispatchContext,
|
||||
PortalStateContext,
|
||||
} from '../../contexts/portal';
|
||||
-import { INITIAL_STATE } from '../../state/constants';
|
||||
-import { reducer } from '../../state/reducer';
|
||||
+import { createPortalStore } from '../../state/store';
|
||||
import type { PortalProviderProps } from './types';
|
||||
|
||||
const PortalProviderComponent = ({
|
||||
@@ -13,10 +12,10 @@ const PortalProviderComponent = ({
|
||||
shouldAddRootHost = true,
|
||||
children,
|
||||
}: PortalProviderProps) => {
|
||||
- const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
|
||||
+ const [store] = useState(createPortalStore);
|
||||
return (
|
||||
- <PortalDispatchContext.Provider value={dispatch}>
|
||||
- <PortalStateContext.Provider value={state}>
|
||||
+ <PortalDispatchContext.Provider value={store.dispatch}>
|
||||
+ <PortalStateContext.Provider value={store}>
|
||||
{children}
|
||||
{shouldAddRootHost && <PortalHost name={rootHostName} />}
|
||||
</PortalStateContext.Provider>
|
||||
diff --git a/node_modules/@gorhom/portal/src/contexts/portal.ts b/node_modules/@gorhom/portal/src/contexts/portal.ts
|
||||
index 2e3a46f..85ff020 100644
|
||||
--- a/node_modules/@gorhom/portal/src/contexts/portal.ts
|
||||
+++ b/node_modules/@gorhom/portal/src/contexts/portal.ts
|
||||
@@ -1,10 +1,7 @@
|
||||
import { createContext } from 'react';
|
||||
+import type { PortalStore } from '../state/store';
|
||||
import type { ActionTypes } from '../state/types';
|
||||
-import type { PortalType } from '../types';
|
||||
|
||||
-export const PortalStateContext = createContext<Record<
|
||||
- string,
|
||||
- Array<PortalType>
|
||||
-> | null>(null);
|
||||
+export const PortalStateContext = createContext<PortalStore | null>(null);
|
||||
export const PortalDispatchContext =
|
||||
createContext<React.Dispatch<ActionTypes> | null>(null);
|
||||
diff --git a/node_modules/@gorhom/portal/src/hooks/usePortalState.ts b/node_modules/@gorhom/portal/src/hooks/usePortalState.ts
|
||||
index 64bb180..d9877c3 100644
|
||||
--- a/node_modules/@gorhom/portal/src/hooks/usePortalState.ts
|
||||
+++ b/node_modules/@gorhom/portal/src/hooks/usePortalState.ts
|
||||
@@ -1,14 +1,16 @@
|
||||
-import { useContext } from 'react';
|
||||
+import { useContext, useSyncExternalStore } from 'react';
|
||||
import { PortalStateContext } from '../contexts/portal';
|
||||
|
||||
export const usePortalState = (hostName: string) => {
|
||||
- const state = useContext(PortalStateContext);
|
||||
+ const store = useContext(PortalStateContext);
|
||||
|
||||
- if (state === null) {
|
||||
+ if (store === null) {
|
||||
throw new Error(
|
||||
"'PortalStateContext' cannot be null, please add 'PortalProvider' to the root component."
|
||||
);
|
||||
}
|
||||
|
||||
- return state[hostName] || [];
|
||||
+ const getPortals = () => store.getPortals(hostName);
|
||||
+
|
||||
+ return useSyncExternalStore(store.subscribe, getPortals, getPortals);
|
||||
};
|
||||
diff --git a/node_modules/@gorhom/portal/src/state/reducer.ts b/node_modules/@gorhom/portal/src/state/reducer.ts
|
||||
index 37f2414..1370244 100644
|
||||
--- a/node_modules/@gorhom/portal/src/state/reducer.ts
|
||||
+++ b/node_modules/@gorhom/portal/src/state/reducer.ts
|
||||
@@ -38,15 +38,15 @@ const addUpdatePortal = (
|
||||
/**
|
||||
* updated portal, if it was already added.
|
||||
*/
|
||||
- const index = state[hostName].findIndex(item => item.name === portalName);
|
||||
- if (index !== -1) {
|
||||
- state[hostName][index].node = node;
|
||||
- } else {
|
||||
- state[hostName].push({
|
||||
- name: portalName,
|
||||
- node,
|
||||
- });
|
||||
- }
|
||||
+ // Paseo patch: a changed host gets a new array, so the store can hand each host its own
|
||||
+ // snapshot and only the host whose portals changed renders.
|
||||
+ const portals = state[hostName];
|
||||
+ const index = portals.findIndex(item => item.name === portalName);
|
||||
+ const portal = { name: portalName, node };
|
||||
+ state[hostName] =
|
||||
+ index !== -1
|
||||
+ ? portals.map(item => (item.name === portalName ? portal : item))
|
||||
+ : [...portals, portal];
|
||||
return state;
|
||||
};
|
||||
|
||||
@@ -65,7 +65,9 @@ const removePortal = (
|
||||
}
|
||||
|
||||
const index = state[hostName].findIndex(item => item.name === portalName);
|
||||
- if (index !== -1) state[hostName].splice(index, 1);
|
||||
+ if (index !== -1) {
|
||||
+ state[hostName] = state[hostName].filter(item => item.name !== portalName);
|
||||
+ }
|
||||
return state;
|
||||
};
|
||||
|
||||
diff --git a/node_modules/@gorhom/portal/src/state/store.ts b/node_modules/@gorhom/portal/src/state/store.ts
|
||||
new file mode 100644
|
||||
index 0000000..4acf035
|
||||
--- /dev/null
|
||||
+++ b/node_modules/@gorhom/portal/src/state/store.ts
|
||||
@@ -0,0 +1,30 @@
|
||||
+import { INITIAL_STATE } from './constants';
|
||||
+import { reducer } from './reducer';
|
||||
+import type { PortalType } from '../types';
|
||||
+import type { ActionTypes } from './types';
|
||||
+
|
||||
+const NO_PORTALS: Array<PortalType> = [];
|
||||
+
|
||||
+// Paseo patch: portal state lives in a store, outside React state. Held in the provider's context
|
||||
+// value it changed on every portal add, update and remove, and React then walked every fiber under
|
||||
+// the provider (the whole app) to find the hosts consuming it. Hosts subscribe here instead.
|
||||
+export const createPortalStore = () => {
|
||||
+ let state: Record<string, Array<PortalType>> = INITIAL_STATE;
|
||||
+ const listeners = new Set<() => void>();
|
||||
+
|
||||
+ return {
|
||||
+ getPortals: (hostName: string) => state[hostName] || NO_PORTALS,
|
||||
+ dispatch: (action: ActionTypes) => {
|
||||
+ state = reducer(state, action);
|
||||
+ listeners.forEach(listener => listener());
|
||||
+ },
|
||||
+ subscribe: (listener: () => void) => {
|
||||
+ listeners.add(listener);
|
||||
+ return () => {
|
||||
+ listeners.delete(listener);
|
||||
+ };
|
||||
+ },
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+export type PortalStore = ReturnType<typeof createPortalStore>;
|
||||
@@ -0,0 +1,170 @@
|
||||
diff --git a/node_modules/react-dom/cjs/react-dom-client.development.js b/node_modules/react-dom/cjs/react-dom-client.development.js
|
||||
index 771ecad..3d9bf72 100644
|
||||
--- a/node_modules/react-dom/cjs/react-dom-client.development.js
|
||||
+++ b/node_modules/react-dom/cjs/react-dom-client.development.js
|
||||
@@ -4073,6 +4073,8 @@
|
||||
? "Idle"
|
||||
: "Other";
|
||||
}
|
||||
+ // Paseo backport of React 19.3.0: clear each measure once it is reported. The browser keeps
|
||||
+ // every measure for the life of the page, so a long development session held millions.
|
||||
function logComponentTrigger(fiber, startTime, endTime, trigger) {
|
||||
supportsUserTiming &&
|
||||
((reusableComponentOptions.start = startTime),
|
||||
@@ -4088,7 +4090,7 @@
|
||||
reusableComponentOptions
|
||||
)
|
||||
)
|
||||
- : performance.measure(trigger, reusableComponentOptions));
|
||||
+ : performance.measure(trigger, reusableComponentOptions), performance.clearMeasures(trigger));
|
||||
}
|
||||
function logComponentReappeared(fiber, startTime, endTime) {
|
||||
logComponentTrigger(fiber, startTime, endTime, "Reconnect");
|
||||
@@ -4159,7 +4161,7 @@
|
||||
: performance.measure(
|
||||
"\u200b" + name,
|
||||
reusableComponentOptions
|
||||
- )))
|
||||
+ ), performance.clearMeasures("\u200b" + name)))
|
||||
: null != selfTime
|
||||
? selfTime.run(
|
||||
console.timeStamp.bind(
|
||||
@@ -4229,7 +4231,7 @@
|
||||
? debugTask.run(
|
||||
performance.measure.bind(performance, "\u200b" + name, fiber)
|
||||
)
|
||||
- : performance.measure("\u200b" + name, fiber);
|
||||
+ : performance.measure("\u200b" + name, fiber), performance.clearMeasures("\u200b" + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4274,7 +4276,7 @@
|
||||
startTime
|
||||
)
|
||||
)
|
||||
- : performance.measure("\u200b" + name, startTime);
|
||||
+ : performance.measure("\u200b" + name, startTime), performance.clearMeasures("\u200b" + name);
|
||||
}
|
||||
}
|
||||
} else
|
||||
@@ -4434,7 +4436,7 @@
|
||||
? debugTask.run(
|
||||
performance.measure.bind(performance, "Recovered", startTime)
|
||||
)
|
||||
- : performance.measure("Recovered", startTime);
|
||||
+ : performance.measure("Recovered", startTime), performance.clearMeasures("Recovered");
|
||||
}
|
||||
}
|
||||
function logErroredRenderPhase(startTime, endTime, lanes, debugTask) {
|
||||
@@ -4517,7 +4519,7 @@
|
||||
? debugTask.run(
|
||||
performance.measure.bind(performance, "Errored", startTime)
|
||||
)
|
||||
- : performance.measure("Errored", startTime);
|
||||
+ : performance.measure("Errored", startTime), performance.clearMeasures("Errored");
|
||||
}
|
||||
}
|
||||
function logAnimatingPhase(startTime, endTime, debugTask) {
|
||||
@@ -17111,7 +17113,7 @@
|
||||
previousRenderStartTime
|
||||
)
|
||||
)
|
||||
- : performance.measure(isSpawnedUpdate, previousRenderStartTime));
|
||||
+ : performance.measure(isSpawnedUpdate, previousRenderStartTime), performance.clearMeasures(isSpawnedUpdate));
|
||||
}
|
||||
blockingUpdateTime = -1.1;
|
||||
blockingUpdateType = 0;
|
||||
@@ -17248,7 +17250,7 @@
|
||||
previousRenderStartTime
|
||||
)
|
||||
)
|
||||
- : performance.measure(debugTask, previousRenderStartTime))),
|
||||
+ : performance.measure(debugTask, previousRenderStartTime), performance.clearMeasures(debugTask))),
|
||||
(transitionUpdateTime = transitionStartTime = -1.1),
|
||||
(transitionUpdateType = 0),
|
||||
(transitionSuspendedTime = -1.1),
|
||||
diff --git a/node_modules/react-dom/cjs/react-dom-profiling.development.js b/node_modules/react-dom/cjs/react-dom-profiling.development.js
|
||||
index c8b583c..7fd2231 100644
|
||||
--- a/node_modules/react-dom/cjs/react-dom-profiling.development.js
|
||||
+++ b/node_modules/react-dom/cjs/react-dom-profiling.development.js
|
||||
@@ -4081,6 +4081,8 @@
|
||||
? "Idle"
|
||||
: "Other";
|
||||
}
|
||||
+ // Paseo backport of React 19.3.0: clear each measure once it is reported. The browser keeps
|
||||
+ // every measure for the life of the page, so a long development session held millions.
|
||||
function logComponentTrigger(fiber, startTime, endTime, trigger) {
|
||||
supportsUserTiming &&
|
||||
((reusableComponentOptions.start = startTime),
|
||||
@@ -4096,7 +4098,7 @@
|
||||
reusableComponentOptions
|
||||
)
|
||||
)
|
||||
- : performance.measure(trigger, reusableComponentOptions));
|
||||
+ : performance.measure(trigger, reusableComponentOptions), performance.clearMeasures(trigger));
|
||||
}
|
||||
function logComponentReappeared(fiber, startTime, endTime) {
|
||||
logComponentTrigger(fiber, startTime, endTime, "Reconnect");
|
||||
@@ -4167,7 +4169,7 @@
|
||||
: performance.measure(
|
||||
"\u200b" + name,
|
||||
reusableComponentOptions
|
||||
- )))
|
||||
+ ), performance.clearMeasures("\u200b" + name)))
|
||||
: null != selfTime
|
||||
? selfTime.run(
|
||||
console.timeStamp.bind(
|
||||
@@ -4237,7 +4239,7 @@
|
||||
? debugTask.run(
|
||||
performance.measure.bind(performance, "\u200b" + name, fiber)
|
||||
)
|
||||
- : performance.measure("\u200b" + name, fiber);
|
||||
+ : performance.measure("\u200b" + name, fiber), performance.clearMeasures("\u200b" + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4282,7 +4284,7 @@
|
||||
startTime
|
||||
)
|
||||
)
|
||||
- : performance.measure("\u200b" + name, startTime);
|
||||
+ : performance.measure("\u200b" + name, startTime), performance.clearMeasures("\u200b" + name);
|
||||
}
|
||||
}
|
||||
} else
|
||||
@@ -4442,7 +4444,7 @@
|
||||
? debugTask.run(
|
||||
performance.measure.bind(performance, "Recovered", startTime)
|
||||
)
|
||||
- : performance.measure("Recovered", startTime);
|
||||
+ : performance.measure("Recovered", startTime), performance.clearMeasures("Recovered");
|
||||
}
|
||||
}
|
||||
function logErroredRenderPhase(startTime, endTime, lanes, debugTask) {
|
||||
@@ -4525,7 +4527,7 @@
|
||||
? debugTask.run(
|
||||
performance.measure.bind(performance, "Errored", startTime)
|
||||
)
|
||||
- : performance.measure("Errored", startTime);
|
||||
+ : performance.measure("Errored", startTime), performance.clearMeasures("Errored");
|
||||
}
|
||||
}
|
||||
function logAnimatingPhase(startTime, endTime, debugTask) {
|
||||
@@ -17119,7 +17121,7 @@
|
||||
previousRenderStartTime
|
||||
)
|
||||
)
|
||||
- : performance.measure(isSpawnedUpdate, previousRenderStartTime));
|
||||
+ : performance.measure(isSpawnedUpdate, previousRenderStartTime), performance.clearMeasures(isSpawnedUpdate));
|
||||
}
|
||||
blockingUpdateTime = -1.1;
|
||||
blockingUpdateType = 0;
|
||||
@@ -17256,7 +17258,7 @@
|
||||
previousRenderStartTime
|
||||
)
|
||||
)
|
||||
- : performance.measure(debugTask, previousRenderStartTime))),
|
||||
+ : performance.measure(debugTask, previousRenderStartTime), performance.clearMeasures(debugTask))),
|
||||
(transitionUpdateTime = transitionStartTime = -1.1),
|
||||
(transitionUpdateType = 0),
|
||||
(transitionSuspendedTime = -1.1),
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,10 +23,29 @@ const patchedPackages = [
|
||||
// Layout constraints: backport of https://github.com/jpudysz/react-native-unistyles/pull/1357
|
||||
// (commit from the root the commit hands us, so a concurrent window-size commit is kept).
|
||||
// Remove the ShadowTreeManager hunk when the installed release includes that PR.
|
||||
// Web stylesheet: backport of https://github.com/jpudysz/react-native-unistyles/pull/1354
|
||||
// (3.8.0). Classes are added and removed as CSSOM rules, not by rewriting the style tag, which
|
||||
// made the browser restyle the whole document. Remove the web/css hunks at >= 3.8.0.
|
||||
{
|
||||
nodeModulesPath: "node_modules/react-native-unistyles",
|
||||
patchPrefix: "react-native-unistyles+",
|
||||
},
|
||||
// Portal state lives in a store that each host subscribes to. As the provider's context value it
|
||||
// changed on every portal add, update and remove, and React searched every fiber under the
|
||||
// provider (the whole app) for consumers. No upstream fix; keep while the app uses this package.
|
||||
// Keyed hosts: backport of https://github.com/gorhom/react-native-portal/pull/62, unreleased
|
||||
// after 1.0.14. Remove the PortalHost hunks when an installed release includes it.
|
||||
{
|
||||
nodeModulesPath: "node_modules/@gorhom/portal",
|
||||
patchPrefix: "@gorhom+portal+",
|
||||
},
|
||||
// Backport of React 19.3.0 to the development builds: clear each render timing after reporting
|
||||
// it. The browser keeps every performance measure for the life of the page, so a development
|
||||
// session held millions of them and gigabytes of memory. Remove when react-dom is >= 19.3.0.
|
||||
{
|
||||
nodeModulesPath: "node_modules/react-dom",
|
||||
patchPrefix: "react-dom+",
|
||||
},
|
||||
// Backport of https://github.com/software-mansion/react-native-reanimated/pull/10435
|
||||
// (Reanimated 4.7.1): skip synchronous Android prop updates for unmounted view tags
|
||||
// instead of throwing and printing a full stack trace on the UI thread per tag per event.
|
||||
|
||||
Reference in New Issue
Block a user