question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve docs on Fragments, how exactly is it working

See original GitHub issue

Hey, so I am relying on data from the database to verify certain fields, so it seems using fragments would be beneficial for my use case. However I am not really sure how they work or what they do.

So there is this in the docs:

const isItemOwner = rule({
  cache: 'strict',
  fragment: 'fragment ItemID on Item { id }',
})(async ({ id }, args, ctx, info) => {
  return ctx.db.exists.Item({
    id,
    owner: { id: ctx.user.id },
  })
})

Does it provide a way to cache the data you get from the Item query or what is it doing here?

Also why are you getting id from the parent argument and not from args ? I would be happy if I could get some explanation of how exacyly fragments work together with graphql-shield.

(I know what fragments in general are, (I think))

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
chrisknuteson-qumulexcommented, Jan 3, 2020

@maticzav That does, thank you. I’ve been using prisma-client (which doesnt support the fragment option) and need to investigate switching over to the prisma-binding (which does)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fragments | Android Developers
Fragments introduce modularity and reusability into your activity's UI by allowing you to divide the UI into discrete chunks. Activities are an ...
Read more >
Does using a document fragment really improve performance?
Document Fragment is much faster when it is used to insert a set of elements in multiple places. Most answers here point out...
Read more >
Document Fragments and why you should use them
A document fragment is a fragment of a Document Object Model (DOM) tree, a chunk of tree that's separated from the rest of...
Read more >
FINDING AND FIXING FRAGMENTS
A fragment is a group of words that does not function as a complete sentence and so cannot stand alone. It cannot begin...
Read more >
Why You Should Use Document Fragments - Webtips
If you make heavy use of DOM manipulations, you might be want to optimize your calls by using document fragments. Find out how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found