-
Notifications
You must be signed in to change notification settings - Fork 2
Fix artifact title in listing (use title/artifact/name priority) #241 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix artifact title in listing (use title/artifact/name priority) #241 #3
Conversation
📝 WalkthroughWalkthroughUpdated a single Svelte component to adjust import/indentation formatting, add comment blocks around the main list markup, and change item label rendering from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (2)
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. Comment |
There was a problem hiding this 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 ofany[].Using
any[]bypasses TypeScript's type safety. Consider defining an interface for the collection items with properties liketitle,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
📒 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.
| <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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cd /tmp && find . -name "*.svelte" -type f 2>/dev/null | head -20Repository: dbpedia/databus-moss-frontend
Length of output: 202
🏁 Script executed:
git ls-files | grep -E "\.(svelte|js|ts)$" | head -20Repository: dbpedia/databus-moss-frontend
Length of output: 202
🏁 Script executed:
rg -n -C3 -g '*.svelte' '<Listgroup' | head -100Repository: 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>(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.
|
Note: Issue #241 was opened in the dbpedia/databus repository, but the bug is actually in the user interface (frontend). |
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:
title (preferred, human-readable)
artifact (dataset/artifact name)
name (fallback, original behavior)
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.