Comfy-Org / Comfy-Org/ComfyUI_frontend

refactor: rename shadowed `t` parameter in `maxMembersByTier` computed in PricingTableWorkspace.vue

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

Description

## Summary

In `src/platform/workspace/components/PricingTableWorkspace.vue`, the `maxMembersByTier` computed property uses a `.map()` callback parameter named `t`, which shadows the `t` function imported from `useI18n()`:

```ts
const maxMembersByTier = computed(
() =>
Object.fromEntries(tiers.map((t) => [t.key, getMaxSeats(t.key)])) as Record<
CheckoutTierKey,
number
>
)
```

The callback currently only accesses tier properties, so it is safe today. However, if an i18n call is ever added inside the callback, it would silently call the tier object instead of the translation function.

## Proposed Fix

Rename the callback parameter from `t` to `tier` to eliminate the shadow risk:

```ts
const maxMembersByTier = computed(
() =>
Object.fromEntries(tiers.map((tier) => [tier.key, getMaxSeats(tier.key)])) as Record<
CheckoutTierKey,
number
>
)
```

## Context

- Raised in PR #9901: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9901
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9901#discussion_r2945814515
- Requested by @christian-byrne

## Labels

refactor, non-blocking

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10211-refactor-rename-shadowed-t-parameter-in-maxMembersByTier-computed-in-PricingTabl-3266d73d36508129ac14e01f52aa06b5) 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.