Skip to content

Conversation

@jumski
Copy link
Contributor

@jumski jumski commented Nov 19, 2025

Fix setTimeout context binding issue in SupabaseBroadcastAdapter

This PR fixes a browser compatibility issue in the SupabaseBroadcastAdapter class where setTimeout was losing its context binding when used in browser environments. The issue would cause an error: "'setTimeout' called on an object that does not implement interface Window".

The fix:

  • Properly binds setTimeout to the global context using setTimeout.bind(globalThis) in the constructor
  • Adds comprehensive tests to verify the fix works correctly

This issue only manifested in browser environments, not in Node.js, which explains why our existing tests didn't catch it. I've added a test that simulates the browser's strict context requirements for setTimeout.

The PR also includes a planning document for implementing browser-based testing to catch similar issues in the future.

@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2025

🦋 Changeset detected

Latest commit: 76d65a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@pgflow/client Patch
@pgflow/core Patch
@pgflow/dsl Patch
@pgflow/edge-worker Patch
pgflow Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor Author

jumski commented Nov 19, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@nx-cloud
Copy link

nx-cloud bot commented Nov 19, 2025

View your CI Pipeline Execution ↗ for commit 76d65a1

Command Status Duration Result
nx run client:e2e ✅ Succeeded 1m 9s View ↗
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 3s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 3s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 21s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-27 18:59:11 UTC

@jumski jumski force-pushed the 11-19-fix_settimeout_binding_in_client branch from 441c31b to 2e8d068 Compare November 19, 2025 14:28
@jumski jumski force-pushed the 11-19-fix_settimeout_binding_in_client branch from 2e8d068 to d391b09 Compare December 27, 2025 18:07
@jumski jumski force-pushed the 11-19-fix_settimeout_binding_in_client branch from d391b09 to b7d08e1 Compare December 27, 2025 18:12
@jumski
Copy link
Contributor Author

jumski commented Dec 27, 2025

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

🔍 Preview Deployment: Website

Deployment successful!

🔗 Preview URL: https://pr-402.pgflow.pages.dev

📝 Details:

  • Branch: 11-19-fix_settimeout_binding_in_client
  • Commit: 4bc36d3447fb75ae1c0ec249f63e318bf5f3c9f1
  • View Logs

_Last updated: _

@jumski jumski force-pushed the 11-19-fix_settimeout_binding_in_client branch from b7d08e1 to 76d65a1 Compare December 27, 2025 18:54
Copy link
Contributor Author

jumski commented Dec 27, 2025

Merge activity

  • Dec 27, 6:59 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 27, 7:00 PM UTC: @jumski merged this pull request with Graphite.

@jumski jumski merged commit d7e77fd into main Dec 27, 2025
13 checks passed
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.

2 participants