Skip to content

fix(realtime): forward opts to send() in track()#2490

Merged
edgurgel merged 2 commits into
supabase:masterfrom
FrancoKaddour:fix/realtime-track-opts-not-forwarded
Jul 15, 2026
Merged

fix(realtime): forward opts to send() in track()#2490
edgurgel merged 2 commits into
supabase:masterfrom
FrancoKaddour:fix/realtime-track-opts-not-forwarded

Conversation

@FrancoKaddour

Copy link
Copy Markdown
Contributor

What

RealtimeChannel.track() accepts an opts parameter (e.g. { timeout: 5000 }), but was passing opts.timeout || this.timeout — a plain number — as the second argument to send(). Since send() expects opts: { [key: string]: any }, accessing .timeout on a number always returns undefined, so the actual timeout from the caller is silently ignored.

untrack() already passes opts directly and works correctly. This aligns track() with the same behavior.

Before

async track(payload, opts = {}) {
  return await this.send({ type: 'presence', event: 'track', payload }, opts.timeout || this.timeout)
  //                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  //                                                          number passed where object is expected
}

After

async track(payload, opts = {}) {
  return await this.send({ type: 'presence', event: 'track', payload }, opts)
}

track() was passing opts.timeout (a number) as the second argument to
send(), but send() expects an options object. Accessing opts.timeout
inside send() always returns undefined, so any custom timeout passed
to track() is silently ignored.

Pass opts directly, consistent with how untrack() already behaves.
@FrancoKaddour
FrancoKaddour requested review from a team as code owners July 3, 2026 13:55
@edgurgel

Copy link
Copy Markdown
Member

@FrancoKaddour would you mind adding some form of test to ensure these are being passed properly? This way we won't break this in the future

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2490

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2490

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2490

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2490

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2490

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2490

commit: d374f87

@coveralls

coveralls commented Jul 14, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 95.493% (+15.2%) from 80.303% — FrancoKaddour:fix/realtime-track-opts-not-forwarded into supabase:master

@FrancoKaddour

Copy link
Copy Markdown
Contributor Author

Done — added three tests in RealtimeChannel.presence.test.ts: track() forwarding a
custom opts.timeout down to the underlying push, track() falling back to the channel
timeout when no opts are given, and untrack() forwarding a custom timeout as well.
They follow the same push-spy pattern already used in RealtimeChannel.messaging.test.ts.
Let me know if you'd prefer them structured differently.

@edgurgel edgurgel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@edgurgel
edgurgel merged commit 7fd2bc3 into supabase:master Jul 15, 2026
27 of 28 checks passed
@FrancoKaddour
FrancoKaddour deleted the fix/realtime-track-opts-not-forwarded branch July 15, 2026 02:56
mandarini pushed a commit to supabase/ssr that referenced this pull request Jul 15, 2026
This PR updates `@supabase/supabase-js` to v2.110.6.

**Source**: supabase-js-stable-release

---

## Release Notes

## v2.110.6

## 2.110.6 (2026-07-15)

### 🩹 Fixes

- **postgrest:** type hinted self-referencing embeds as arrays
([#2520](supabase/supabase-js#2520))
- **realtime:** forward opts to send() in track()
([#2490](supabase/supabase-js#2490))
- **supabase:** warn instead of throw for unrecognized sb_ API key
subtypes ([#2526](supabase/supabase-js#2526))

### ❤️ Thank You

- Franco Kaddour @FrancoKaddour
- Katerina Skroumpelou @mandarini

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/supabase that referenced this pull request Jul 15, 2026
This PR updates @supabase/*-js libraries to version 2.110.6.

**Source**: supabase-js-stable-release

**Changes**:
- Updated @supabase/supabase-js to 2.110.6
- Updated @supabase/auth-js to 2.110.6
- Updated @supabase/realtime-js to 2.110.6
- Updated @supabase/postgest-js to 2.110.6
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.110.6

## 2.110.6 (2026-07-15)

### 🩹 Fixes

- **postgrest:** type hinted self-referencing embeds as arrays
([#2520](supabase/supabase-js#2520))
- **realtime:** forward opts to send() in track()
([#2490](supabase/supabase-js#2490))
- **supabase:** warn instead of throw for unrecognized sb_ API key
subtypes ([#2526](supabase/supabase-js#2526))

### ❤️ Thank You

- Franco Kaddour @FrancoKaddour
- Katerina Skroumpelou @mandarini
## v2.110.5

## 2.110.5 (2026-07-14)

### 🩹 Fixes

- **supabase:** avoid edge runtime warning
([#2522](supabase/supabase-js#2522))

### ❤️ Thank You

- Vaibhav @7ttp
## v2.110.4

## 2.110.4 (2026-07-14)

### 🩹 Fixes

- **functions:** stop sending API key in Authorization header for
function calls
([#2511](supabase/supabase-js#2511))
- **realtime:** encode broadcast header fields as UTF-8
([#2516](supabase/supabase-js#2516))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Pedro Henrique
## v2.110.3

## 2.110.3 (2026-07-13)

### 🩹 Fixes

- **auth:** preserve pkce verifier
([#2513](supabase/supabase-js#2513))
- **postgrest:** pin tstyche target off floating latest
([#2509](supabase/supabase-js#2509))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Vaibhav @7ttp
## v2.110.2

## 2.110.2 (2026-07-09)

### 🩹 Fixes

- **auth:** clear local session on signout failures
([#2504](supabase/supabase-js#2504))

### ❤️ Thank You

- Luc Peng

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants