Title: Attrs are never observed unless added with `@attr` decorator · Issue #208 · github/catalyst · GitHub
Open Graph Title: Attrs are never observed unless added with `@attr` decorator · Issue #208 · github/catalyst
X Title: Attrs are never observed unless added with `@attr` decorator · Issue #208 · github/catalyst
Description: Hi folks, While I was testing the attributes — trying to work my way around #207 — I found another subtle detail. Manually initialized attributes are never observed. Catalyst's guide provides the following example for vanilla users: http...
Open Graph Description: Hi folks, While I was testing the attributes — trying to work my way around #207 — I found another subtle detail. Manually initialized attributes are never observed. Catalyst's guide provides the f...
X Description: Hi folks, While I was testing the attributes — trying to work my way around #207 — I found another subtle detail. Manually initialized attributes are never observed. Catalyst's guide provides t...
Opengraph URL: https://github.com/github/catalyst/issues/208
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Attrs are never observed unless added with `@attr` decorator","articleBody":"Hi folks,\r\n\r\nWhile I was testing the attributes — trying to work my way around #207 — I found another subtle detail. Manually initialized attributes are never observed.\r\n\r\nCatalyst's guide provides the following example for vanilla users: https://github.com/github/catalyst/blob/main/docs/_guide/attrs.md#what-about-without-decorators.\r\n\r\nPlease notice the second argument there `defineObservedAttributes(HelloWorldElement, ['foo'])` and compare it with the actual function declaration:\r\n\r\nhttps://github.com/github/catalyst/blob/a8fb3ba59a4ac258d0fe64a50ecd3b6997f5f016/src/attr.ts#L99\r\n\r\nIt doesn't expect the second argument (`arguments` aren't used either).\r\n\r\nNow, internally `defineObservedAttributes()` pulls attribute names from `getAttrNames()`, which, in turn, pulls them from `attrs` (`WeakMap`). The only way to populate `attrs` is to use `@attr` decorator:\r\n\r\nhttps://github.com/github/catalyst/blob/a8fb3ba59a4ac258d0fe64a50ecd3b6997f5f016/src/attr.ts#L15\r\n\r\nMaybe I'm missing something, but it seems like there's no way to specify observed attributes without decorators. In any case, it'd be very nice to clarify that 🙂\r\n\r\nThank you!","author":{"url":"https://github.com/kristoforsalmin","@type":"Person","name":"kristoforsalmin"},"datePublished":"2022-04-29T12:49:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/208/catalyst/issues/208"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7181c1e3-ce85-c5be-9717-fb1a563c7ec2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFC6:32C291:282434:35DFD1:6A6285F8 |
| html-safe-nonce | aae8b999015a064dca3fd331996f4b4275c25ca33e323f5dfd5570154cf3fdf7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkM2OjMyQzI5MToyODI0MzQ6MzVERkQxOjZBNjI4NUY4IiwidmlzaXRvcl9pZCI6IjI1MTIwOTM4OTg5Njc1MTY2NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 849d037d32c5d6f092272b893dcb03cbcc5d7afd439a64e21719397b3898b1b8 |
| hovercard-subject-tag | issue:1220743234 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/catalyst/208/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d1ac931fd84ff9541ac000e62981114e41af3db40ec9dfbb530a5d4783587ffc/github/catalyst/issues/208 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d1ac931fd84ff9541ac000e62981114e41af3db40ec9dfbb530a5d4783587ffc/github/catalyst/issues/208 |
| og:image:alt | Hi folks, While I was testing the attributes — trying to work my way around #207 — I found another subtle detail. Manually initialized attributes are never observed. Catalyst's guide provides the f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kristoforsalmin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a4ef49a11a2c05de16a801b29c54a151d2e3262d6fd17381ca13b5ae25dda8f |
| turbo-cache-control | no-preview |
| go-import | github.com/github/catalyst git https://github.com/github/catalyst.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 240087376 |
| octolytics-dimension-repository_nwo | github/catalyst |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 240087376 |
| octolytics-dimension-repository_network_root_nwo | github/catalyst |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 97b18c8f1d2683a31995fd6e802daf9bf0d4d3f0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width