Skip to content

Commit 959c4cf

Browse files
committed
fix(remote-config, other): return friendly error for onConfigUpdated
1 parent 6c94626 commit 959c4cf

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

packages/remote-config/e2e/config.e2e.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,20 @@ describe('remoteConfig()', function () {
781781
});
782782
});
783783

784-
xdescribe('onConfigUpdated', function () {
784+
describe('onConfigUpdated on un-supported platforms', function () {
785+
it('returns a descriptive error message if called', async function () {
786+
const { getRemoteConfig, onConfigUpdated } = remoteConfigModular;
787+
try {
788+
onConfigUpdated(getRemoteConfig());
789+
} catch (error) {
790+
error.message.should.containEql('Not supported by the Firebase Javascript SDK');
791+
}
792+
});
793+
});
794+
795+
xdescribe('onConfigUpdated on supported platforms', function () {
785796
if (Platform.other) {
786-
// Not supported on Web.
797+
// Not supported on Web, verify we get a nice error
787798
return;
788799
}
789800

packages/remote-config/lib/web/RNFBConfigModule.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
makeIDBAvailable,
1010
setCustomSignals,
1111
} from '@react-native-firebase/app/lib/internal/web/firebaseRemoteConfig';
12-
import { guard } from '@react-native-firebase/app/lib/internal/web/utils';
12+
import { guard, getWebError } from '@react-native-firebase/app/lib/internal/web/utils';
1313

1414
let configSettingsForInstance = {
1515
// [APP_NAME]: RemoteConfigSettings
@@ -121,4 +121,7 @@ export default {
121121
return resultAndConstants(remoteConfig, null);
122122
});
123123
},
124+
onConfigUpdated() {
125+
return getWebError('unsupported', 'Not supported by the Firebase Javascript SDK.');
126+
},
124127
};

0 commit comments

Comments
 (0)