Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai a1b99d8480 fix(editor): key navigation bar segments by position
A path deeper than four folders collapses its middle into an ellipsis
whose tooltip is the whole relative path, the same as the last folder's,
so React warned about two children with the same key. Segments are now
keyed by their position as well.
2026-11-24 17:53:24 +08:00
2 змінених файлів з 16 додано та 1 видалено

No files matched your search

+1 -1
Переглянути файл
@@ -248,7 +248,7 @@ function CrumbNav({
const current = i === segments.length - 1;
const icon = s.nav?.kind === "dir" && !s.nav.root && !current ? undefined : s.icon;
return (
<Fragment key={s.title}>
<Fragment key={`${i}:${s.title}`}>
{i > 0 && <Icon name="chevron-right" size={12} className={styles.statusSep} />}
<BarButton
className={styles.crumbButton}
+15
Переглянути файл
@@ -292,3 +292,18 @@ it("shows the revision and the file's folders for a file at a Git revision", ()
view.unmount();
useProject.setState({ project: null, settings: null });
});
it("elides the middle of a deep path without a duplicate React key", () => {
useProject.setState({
project: { root: "/p", name: "app", settings: {}, trusted: true, isGit: false },
settings: { appearance: { navigationBar: "top" } } as unknown as Settings,
});
useEditorStatus.setState({ status: { ...caret(0, 0), path: "/p/src/main/java/com/example/orders/Rule.java" } });
const error = vi.spyOn(console, "error").mockImplementation(() => {});
const view = render(<Breadcrumbs className="nav" />);
expect(screen.getByRole("navigation", { name: "Breadcrumbs" }).textContent).toBe("appsrc…exampleordersRule.java");
expect(error).not.toHaveBeenCalled();
error.mockRestore();
view.unmount();
useProject.setState({ project: null, settings: null });
});