fix(cli): report the default channel when native config has none - #1240
Conversation
`getChannel` layered the parser result over `{ value: "production" }` with
es-toolkit `merge`, but `merge` only skips `undefined` source values. When a
project has no channel in AndroidManifest.xml or Info.plist the parser returns
`value: null`, which overwrote the default, so `hot-updater channel` printed an
empty channel while the app was actually running on `production` (the native
`DEFAULT_CHANNEL`).
Fall back with `??` so an absent channel reports the same value the native
runtime uses.
|
@giaBaoJS is attempting to deploy a commit to the hot-updater Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 733cc6c The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
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 |
@hot-updater/android-helper
@hot-updater/apple-helper
@hot-updater/bsdiff
@hot-updater/cli-tools
@hot-updater/console
@hot-updater/core
hot-updater
@hot-updater/react-native
@hot-updater/server
@hot-updater/aws
@hot-updater/bare
@hot-updater/bugsnag-plugin
@hot-updater/cloudflare
@hot-updater/datadog-plugin
@hot-updater/expo
@hot-updater/firebase
@hot-updater/js
@hot-updater/plugin-core
@hot-updater/postgres
@hot-updater/rock
@hot-updater/sentry-plugin
@hot-updater/standalone
@hot-updater/supabase
commit: |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Backport #1240 to next so the channel command reports the same production fallback used by the native runtime. Co-authored-by: Bao Nguyen <waycaosi1994@gmail.com>
hot-updater channelreports an empty channel on any project that has never hada channel written into its native files, even though the app is running on
production.Cause
getChannelbuilds its result by layering the parser output over a default:es-toolkit
mergeonly leaves the target value in place when the source value isundefined. Anullsource value is copied over:AndroidConfigParser.getandIosConfigParser.getreturn{ value: null }whenthe key is absent, so the
productiondefault is always discarded in exactly thecase it exists for. Both platforms are affected
(
packages/hot-updater/src/utils/setChannel.ts).Effect
initdoes not write a channel, so this is the state of a project until someoneruns
hot-updater channel set.handleChannelpasses the value toui.channel, which renders an empty value as-:That is misleading rather than merely blank: with no channel in the native
config,
HotUpdaterImplfalls back toDEFAULT_CHANNEL = "production"on bothAndroid and iOS, so the app really is on
production. After the fix the commandprints
productionfor both platforms.Change
Fall back with
??instead ofmerge, so only a genuinely absent value isreplaced. Added
setChannel.spec.tscovering both platforms plus thealready-configured case; the two fallback tests fail on
mainwithvalue: null.pnpm lint,pnpm test:typeandpnpm testall pass (169 files, 2162 tests).