-
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?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,36 @@ | ||
| <script lang="ts"> | ||
| import { FolderOpenOutline, FileOutline } from 'flowbite-svelte-icons'; | ||
| import { Listgroup } from 'flowbite-svelte'; | ||
| import { FolderOpenOutline, FileOutline } from 'flowbite-svelte-icons'; | ||
| import { Listgroup } from 'flowbite-svelte'; | ||
|
|
||
| export let collection: any[]; | ||
| export let files = true; | ||
| let iconType = files ? FileOutline : FolderOpenOutline; | ||
| export let collection: any[]; | ||
| export let files = true; | ||
| let iconType = files ? FileOutline : FolderOpenOutline; | ||
|
|
||
| // Debug: Print the first artifact to inspect fields (title, artifact, name, etc.) | ||
| console.log("Artifact sample:", collection?.[0]); | ||
| </script> | ||
|
|
||
| <ul> | ||
| <div class="item-list"> | ||
| <div class="mb-6 grid gap-2 md:grid-cols-1"> | ||
| <div class="item-list-item"> | ||
|
|
||
| <!-- MAIN LIST --> | ||
| <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} | ||
|
Comment on lines
14
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
💡 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: 🌐 Web query:
💡 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:
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 ( The Listgroup items mapping pattern is valid—the code passes 🤖 Prompt for AI Agents |
||
|
|
||
| </li> | ||
| </a> | ||
| </Listgroup> | ||
|
|
||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.