Skip to content

Conversation

@devroy10
Copy link
Contributor

@devroy10 devroy10 commented Sep 12, 2025

Problem

The previous implementation used:

if (
  typeof window !== "undefined" &&
  (!window.location.origin.includes("vercel.app") ||
   !window.location.origin.includes(".com"))
) {
  // fallback
}

This logic is flawed:

  • The condition always evaluates to true because of the !… || !… combination.
  • As a result, the fallback message was always shown.
  • The local API server never ran, even in development.

Solution

This PR fixes this faulty check pattern that was introduced in PR #898

tscircuit_runframe-small.mp4

videolink here

Impact

  • Fixes broken examples (example04, example05) where the local API never initialized.
  • Ensures contributors and maintainers can test locally without unexpected fallback behavior.

/claim #1100

@vercel
Copy link

vercel bot commented Sep 12, 2025

@devroy10 is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

@devroy10
Copy link
Contributor Author

@seveibar ready for a review

@vercel
Copy link

vercel bot commented Sep 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
runframe Ready Ready Preview Comment Sep 12, 2025 6:01am

@seveibar
Copy link
Contributor

can you consolidate this logic into something like isFileApiAccessible(), there is also e.g. example16 that may not be converted

@devroy10
Copy link
Contributor Author

can you consolidate this logic into something like isFileApiAccessible(), there is also e.g. example16 that may not be converted

yeah, sure. Should this util be stored in ./examples/utils ?

@seveibar
Copy link
Contributor

sure

@devroy10
Copy link
Contributor Author

sure

to be on the right side, in addition to examples 4 and 5, I have also identified examples 13,14 and 16 to be reusing this piece of logic.
Is that correct by you?

@devroy10 devroy10 force-pushed the fix/local-api-server branch from a95391c to 5fc6cd4 Compare September 12, 2025 07:59
@devroy10
Copy link
Contributor Author

@seveibar @imrishabh18 changes made, ready for a review now

@seveibar seveibar merged commit b96ec03 into tscircuit:main Sep 13, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants