Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(open-knowledge): hide conflicts-load alert when server is unreachable (#1606)

sarah44a777918fdb
diff --git a/packages/app/src/components/ConflictsSection.dom.test.tsx b/packages/app/src/components/ConflictsSection.dom.test.tsx
index 0e39163fa..8ddc8949a 100644
--- a/packages/app/src/components/ConflictsSection.dom.test.tsx
+++ b/packages/app/src/components/ConflictsSection.dom.test.tsx
@@ -106,7 +106,7 @@ describe('ConflictsSection', () => {
expect(screen.getByTestId('conflicts-section-count').textContent).toBe('3');
});
- test('renders an error band when the hook reports a fetch error', () => {
+ test('renders an error band when the hook reports a server-side fetch error', () => {
mockResult = { conflicts: [], loading: false, error: 'server' };
render(<ConflictsSection />);
const errorBand = screen.getByTestId('conflicts-section-error');
@@ -114,6 +114,14 @@ describe('ConflictsSection', () => {
expect(errorBand.textContent ?? '').toMatch(/Couldn't load conflicts/i);
});
+ test('returns null on a network-level fetch error (FileTree owns the global signal)', () => {
+ mockResult = { conflicts: [], loading: false, error: 'network' };
+ const { container } = render(<ConflictsSection />);
+ expect(container.firstChild).toBeNull();
+ expect(screen.queryByTestId('conflicts-section')).toBeNull();
+ expect(screen.queryByTestId('conflicts-section-error')).toBeNull();
+ });
+
test('returns null while the initial fetch is still loading', () => {
mockResult = { conflicts: [], loading: true, error: null };
const { container } = render(<ConflictsSection />);
diff --git a/packages/app/src/components/ConflictsSection.tsx b/packages/app/src/components/ConflictsSection.tsx
index be8138cf8..f1382e8cc 100644
--- a/packages/app/src/components/ConflictsSection.tsx
+++ b/packages/app/src/components/ConflictsSection.tsx
@@ -17,7 +17,7 @@ export function ConflictsSection() {
if (loading) return null;
- if (error !== null) {
+ if (error === 'server') {
return (
<section
data-testid="conflicts-section"