Skip to content

fix(nanoflow-actions-native): GetStraightLineDistance runtime errors - #688

Merged
NikolaSimsic merged 3 commits into
mainfrom
moo/fix-get-straight-line-distance-main
Oct 22, 2026
Merged

NikolaSimsic merged 3 commits into
mainfrom
moo/fix-get-straight-line-distance-main

Conversation

@stelselim

Copy link
Copy Markdown
Contributor

Checklist

  • Contains unit tests ❌
  • Contains breaking changes ❌
  • Did you update version and changelog? Changelog ✅ (Unreleased), version ❌ (left to the release process)
  • Works in Android / iOS / Web: Not tested manually on this branch; the same change was tested on web on mx/11.12.x.

This PR contains

  • Bug fix

What is the purpose of this PR?

Support ticket: in the latest Nanoflow Commons, the GetStraightLineDistance action fails at runtime. There are two errors, in this order:

  1. deg2rad is not defined
  2. After fixing that: Big is not defined

Relevant changes

  • GetStraightLineDistance.ts: the first statement after // BEGIN EXTRA CODE was a type alias. TypeScript drops type aliases together with their leading comment, so the built file had no // BEGIN EXTRA CODE marker. Studio Pro then discarded the helper functions (deg2rad, kmToStatueMile, kmToNauticalMile). The alias is moved after the helpers so the marker survives.
  • configs/jsactions/rollup-plugin-bigjs-import-replacer.mjs: the plugin removed import { Big } from "big.js"; from all built JS actions, expecting mxbuild to add it back. It does not, so every action that creates Big values failed. The plugin now keeps the import (normalized to double quotes). This affects both Nanoflow Commons and Native Mobile Resources (for example TimeBetween, GetCurrentLocation, ShowProgress, SignIn, GetDeviceInfo).
  • Changelog entries for both modules.

What should be covered while testing?

  • Run GetStraightLineDistance from a nanoflow (web and native) and check the result.
  • Run another action that returns or creates decimals (for example TimeBetween, GetCurrentLocation) on web and native.
  • Check whether Studio Pro shows changes in javascriptsource/ after a fresh module import. The Big import now appears above the generated header, like other imports already do.

Extra comments (optional)

Cherry-pick of the mx/11.12.x fix. Verified: both modules build; every built action has matching EXTRA CODE markers and imports Big where it uses it; the built action returns correct distances in all units (Node + big.js).

🤖 Generated with Claude Code

stelselim and others added 2 commits October 20, 2026 14:31
The bigjs import replacer stripped `import { Big } from "big.js"` from the
build output, assuming mxbuild would re-add it. It does not, so actions
creating Big values failed at runtime with "Big is not defined".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@stelselim
stelselim requested a review from a team as a code owner October 20, 2026 12:36
@NikolaSimsic
NikolaSimsic merged commit 769bef4 into main Oct 22, 2026
19 of 20 checks passed
@NikolaSimsic
NikolaSimsic deleted the moo/fix-get-straight-line-distance-main branch October 22, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants