Skip to content

Conversation

@shoaibkhan-sde
Copy link

@shoaibkhan-sde shoaibkhan-sde commented Dec 1, 2025

Summary

This PR fixes Issue #241, where the artifact listing displayed an incorrect or confusing title such as:

live-fusion-kg-snapshot - 2025-11-11 - dbpedia-io

Instead of the correct dataset/artifact name, e.g.:

Geo-coordinates

The incorrect title came from using collection[index].name, which often contains a fallback string instead of the proper artifact title.

What was changed

Updated the component:

src/lib/components/file-list.svelte

Replaced:

{collection[index].name}

With:

{collection[index].title ?? collection[index].artifact ?? collection[index].name}

This adds a priority-based fallback mechanism:

  1. title (preferred, human-readable)

  2. artifact (dataset/artifact name)

  3. name (fallback, original behavior)

Summary by CodeRabbit

  • Refactor
    • Improved file list item labeling to prioritize title, then artifact, then name for clearer identification.
  • Bug Fix
    • Corrected list item rendering so icons and labels display in the intended order, improving readability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

📝 Walkthrough

Walkthrough

Updated a single Svelte component to adjust import/indentation formatting, add comment blocks around the main list markup, and change item label rendering from collection[index].name to a prioritized expression: titleartifactname.

Changes

Cohort / File(s) Summary
File-list component update
src/lib/components/file-list.svelte
Formatting and indentation adjusted; added MAIN LIST comment block(s); changed rendered label from collection[index].name to a prioritized expression that uses title then artifact then name; minor surrounding markup tweaks and an inline comment noting the rendering fix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the fallback chain (title → artifact → name) is correct and covers expected item shapes.
  • Check the adjusted markup around the list item doesn't affect styling or accessibility.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: fixing artifact title display by implementing a title/artifact/name priority fallback.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 013e4fa and 78a18cb.

📒 Files selected for processing (1)
  • src/lib/components/file-list.svelte (1 hunks)
🔇 Additional comments (2)
src/lib/components/file-list.svelte (2)

2-7: LGTM!

The import statements and export declarations are properly formatted and syntactically correct.


15-15: Helpful documentation comments.

The added comments clearly mark the main list section and document the priority fallback logic, improving code maintainability.

Also applies to: 22-22


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/components/file-list.svelte (1)

5-5: Consider defining a specific interface instead of any[].

Using any[] bypasses TypeScript's type safety. Consider defining an interface for the collection items with properties like title, artifact, name, and _links.

+interface CollectionItem {
+    title?: string;
+    artifact?: string;
+    name: string;
+    _links?: {
+        self?: {
+            href?: string;
+        };
+    };
+}
+
-export let collection: any[];
+export let collection: CollectionItem[];
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 840fb89 and 013e4fa.

📒 Files selected for processing (1)
  • src/lib/components/file-list.svelte (1 hunks)
🔇 Additional comments (1)
src/lib/components/file-list.svelte (1)

25-28: Priority fallback correctly implements the fix.

The implementation correctly uses the priority fallback (title → artifact → name) as specified in the PR objectives, which will display human-readable titles instead of fallback strings.

Comment on lines 14 to +28
<Listgroup items={collection.map((c) => c.name)} let:index>
<a href={collection[index]._links?.self?.href ?? '.'}>
<li class="flex items-center gap-2" style="min-height: 28px;">

<svelte:component this={iconType} class="h-4 w-4" />
{collection[index].name}


<svelte:component this={iconType} class="h-4 w-4" />

<!-- FIX: Used title → artifact → name (in this priority) -->
{collection[index].title
?? collection[index].artifact
?? collection[index].name}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cd /tmp && find . -name "*.svelte" -type f 2>/dev/null | head -20

Repository: dbpedia/databus-moss-frontend

Length of output: 202


🏁 Script executed:

git ls-files | grep -E "\.(svelte|js|ts)$" | head -20

Repository: dbpedia/databus-moss-frontend

Length of output: 202


🏁 Script executed:

rg -n -C3 -g '*.svelte' '<Listgroup' | head -100

Repository: dbpedia/databus-moss-frontend

Length of output: 202


🌐 Web query:

Flowbite Svelte Listgroup component items prop let:index

💡 Result:

Yes — Listgroup exposes each item (and its index) to the default slot when you pass items. Use a svelte:fragment (or let: on the slot) to access let:item and let:index. Example:

<script> import { Listgroup } from "flowbite-svelte"; const items = ["Profile","Settings","Messages","Download"]; </script>
#{index} — {item}

(If you need links/buttons, the docs show the same items prop behaviour and item objects with name/href/current/attrs, etc.). [1][2]

Sources:
[1] Flowbite Svelte — List Group docs.
[2] Flowbite Svelte (next) — List Group docs.


🌐 Web query:

nullish coalescing empty string JavaScript behavior

💡 Result:

Short answer: The nullish coalescing operator (??) treats only null and undefined as “nullish.” An empty string ("") is not nullish, so "" ?? "default" returns "" (not "default"). [1][2]

Example:

  • "" ?? "fallback" // returns "".
  • "" || "fallback" // returns "fallback" (because || treats all falsy values the same). [1]

References: MDN documentation on ?? and a practical guide explaining the difference vs ||. [1][2]


Empty string handling may bypass fallback logic.

The nullish coalescing operator (??) only checks for null and undefined, not empty strings. If title or artifact can be empty strings, they will be displayed instead of falling back to the next option. If empty strings should be treated as missing, consider using the logical OR operator (||) instead, or add explicit empty string checks.

The Listgroup items mapping pattern is valid—the code passes collection.map((c) => c.name) to the items prop while using let:index to access the original collection objects for display, which works correctly with Flowbite Svelte's Listgroup component.

🤖 Prompt for AI Agents
In src/lib/components/file-list.svelte around lines 19 to 28, the displayed
label uses nullish coalescing (??) so empty strings in title or artifact will be
treated as valid values and bypass fallback; update the logic to treat empty
strings as missing by replacing the chain with a check that treats falsy/empty
string as absent (for example use logical OR (||) between title, artifact, and
name, or an explicit ternary/trim check like title && title.trim() ? title :
artifact && artifact.trim() ? artifact : name) so empty strings fall back to the
next field.

@shoaibkhan-sde
Copy link
Author

Note: Issue #241 was opened in the dbpedia/databus repository, but the bug is actually in the user interface (frontend).
That UI code lives in this repository (dbpedia/databus-moss-frontend), not in dbpedia/databus.
Therefore the fix is correctly submitted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant