Skip to content

Commit 9a2e265

Browse files
authored
Merge pull request Expensify#67495 from shubham1206agra/refactor-onyx-20
[NoQA] Replaced Onyx.connect with Onyx.connectWithoutView in addUtilsToWindow
2 parents e4f3cfc + 77a48c5 commit 9a2e265

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/setup/addUtilsToWindow.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Onyx from 'react-native-onyx';
2-
import * as Environment from '@libs/Environment/Environment';
2+
import {isProduction as isProductionLib} from '@libs/Environment/Environment';
33
import markAllPolicyReportsAsRead from '@libs/markAllPolicyReportsAsRead';
4-
import * as Session from '@userActions/Session';
4+
import {setSupportAuthToken} from '@userActions/Session';
55
import type {OnyxKey} from '@src/ONYXKEYS';
66

77
/**
@@ -13,7 +13,7 @@ export default function addUtilsToWindow() {
1313
return;
1414
}
1515

16-
Environment.isProduction().then((isProduction) => {
16+
isProductionLib().then((isProduction) => {
1717
if (isProduction) {
1818
return;
1919
}
@@ -23,8 +23,8 @@ export default function addUtilsToWindow() {
2323
// We intentionally do not offer an Onyx.get API because we believe it will lead to code patterns we don't want to use in this repo, but we can offer a workaround for the sake of debugging
2424
window.Onyx.get = function (key) {
2525
return new Promise((resolve) => {
26-
// eslint-disable-next-line rulesdir/prefer-onyx-connect-in-libs
27-
const connection = Onyx.connect({
26+
// We have opted for `connectWithoutView` here as this is a debugging utility and does not relate to any view.
27+
const connection = Onyx.connectWithoutView({
2828
key,
2929
callback: (value) => {
3030
Onyx.disconnect(connection);
@@ -42,7 +42,7 @@ export default function addUtilsToWindow() {
4242
});
4343
};
4444

45-
window.setSupportToken = Session.setSupportAuthToken;
45+
window.setSupportToken = setSupportAuthToken;
4646

4747
// Workaround to give employees the ability to mark reports as read via the JS console
4848
window.markAllPolicyReportsAsRead = markAllPolicyReportsAsRead;

0 commit comments

Comments
 (0)