atomic-server
atomic-server copied to clipboard
Svelte Lib subresources return string and not array or other iterable
I am trying
<script lang="ts">
import { store } from '@tomic/svelte';
import { getResource, getValue } from '@tomic/svelte';
import { urls } from '@tomic/lib';
const resource = $store.getResourceLoading('link_to_folder');
const resource1 = getResource('link_to_folder');
const name = getValue<string>(resource1, urls.properties.name);
// this returns a string instead of an array
var borrower_names = getValue<string[]>(resource1, urls.properties.subResources);
for (b_name in borrower_names.split(",")) {
console.log(b_name);
}
Do you mean it returns subject strings instead of resources? In that case, that's correct.
Example above needs then
let borrower_names=fetchBorrowers("atomic_url_folder").then(y => borrowers = y);
console.log("Borrowers", borrower_names);
And best way is to use folder (for folder) from:
const folder = await store.getResourceAsync<DataBrowser.Folder>(subject);
console.log(folder);
Can be closed with small documentation update.
Not sure I understand, sorry. What should be updated in the docs? And do you mean the @tomic/svelte docs or @tomic/lib?