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.

Angular template: problems with fragments

See original GitHub issue

Hi,

I found two problems with fragments for the Angular template. This is an extract of the generated code:

const InvoiceCheckResultFragment = gql`
  fragment InvoiceCheckResult on InvoiceCheckResult {
    rowsWithUnknownProductCodes
    unknownShippings {
      ...InvoiceShipping
    }
    shippingsThatWereChargedMultipleTimes
    shippings {
      ...InvoiceShipping
    }
  }

  ${InvoiceShippingFragment}
  ${InvoiceShippingFragment}
`;

...

const InvoiceShippingFragment = gql`
  fragment InvoiceShipping on InvoiceShipping {
    rowsWithUnknownProductCodes
    invoiceNumber
....

The first one is the same one that you have fixed in #591 for react (fragment definition order). TypeScript spits out the error error TS2448: Block-scoped variable 'InvoiceShippingFragment' used before its declaration.

The second problem is that fragments that are referenced twice are included twice in the gql-string. In this case, this is InvoiceShippingFragment.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
blissicommented, Sep 17, 2018

Tested it -> fixed 😃 Thanks a lot!

1reaction
dotansimhacommented, Sep 17, 2018

Fixed in 0.12.3 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular, <template> element and #document-fragment
ngNonBindable on the <template> element or the <img> element seems to have no effect. I am using Angular 10. I need to do...
Read more >
Component View-Template Fragments Retain Bindings And ...
Component View-Template Fragments Retain Bindings And Can Be Moved Around In The DOM In Angular 9.0.0-rc.2. By Ben Nadel on November 17, ...
Read more >
Understanding templates - Angular
In Angular, a template is a blueprint for a fragment of a user interface (UI). Templates are written in HTML, and special syntax...
Read more >
How to include a fragment in an Angular dialog - OpenMRS Talk
Q: Any idea how I can include a fragment in my ngDialog ? Note: Iit is also possible to provide the template as...
Read more >
Passing pieces of markup to components in Angular 2 and ...
Passing pieces of markup to components in Angular 2 and problems with dynamic ... Template reference variables is just a convenient way of ......
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