Comfy-Org / Comfy-Org/ComfyUI_frontend

followup: add `once` option to subscription tier watcher in PostHogTelemetryProvider

Open
#9,835 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

In `src/platform/telemetry/providers/cloud/PostHogTelemetryProvider.ts`, the `setSubscriptionProperties()` method creates a Vue `watch()` on `subscriptionTier` to set PostHog user properties. The watcher currently runs indefinitely.

A follow-up improvement is to add the `once: true` option so the watcher self-terminates after the subscription tier is set for the first time, avoiding the need to manually track and clean up the stop handle.

```ts
private setSubscriptionProperties(): void {
const { subscriptionTier } = useSubscription()
watch(
subscriptionTier,
(tier) => {
if (tier && this.posthog) {
this.posthog.people.set({ subscription_tier: tier })
}
},
{ immediate: true, once: true }
)
}
```

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9764
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9764#discussion_r2921762102
- Requested by: @christian-byrne

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-9835-followup-add-once-option-to-subscription-tier-watcher-in-PostHogTelemetryProvider-3216d73d36508162abaeeeef8736c22f) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.