Skip to content
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

Svelte Lib subresources return string and not array or other iterable #790

Open
AlexMikhalev opened this issue Jan 8, 2024 · 4 comments
Assignees

Comments

@AlexMikhalev
Copy link
Collaborator

AlexMikhalev commented Jan 8, 2024

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);
  }
@joepio
Copy link
Member

joepio commented Jan 15, 2024

Do you mean it returns subject strings instead of resources? In that case, that's correct.

@AlexMikhalev
Copy link
Collaborator Author

Example above needs then

    let borrower_names=fetchBorrowers("atomic_url_folder").then(y => borrowers = y);
    console.log("Borrowers", borrower_names);

@AlexMikhalev
Copy link
Collaborator Author

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.

@joepio
Copy link
Member

joepio commented Jan 17, 2024

Not sure I understand, sorry. What should be updated in the docs? And do you mean the @tomic/svelte docs or @tomic/lib?

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

No branches or pull requests

3 participants