Skip to content

A local-first personal finance app

Use environment checks

Jed Fox650733d51b39
diff --git a/packages/desktop-client/src/components/modals/ManageRulesModal.js b/packages/desktop-client/src/components/modals/ManageRulesModal.js
index d0409b6f3b..9362a1ee5d 100644
--- a/packages/desktop-client/src/components/modals/ManageRulesModal.js
+++ b/packages/desktop-client/src/components/modals/ManageRulesModal.js
@@ -1,12 +1,16 @@
import React, { useState } from 'react';
import { Modal } from 'loot-design/src/components/common';
+import {
+ isDevelopmentEnvironment,
+ isPreviewEnvironment
+} from 'loot-design/src/util/environment';
import ManageRules from '../ManageRules';
export default function ManageRulesModal({ modalProps, payeeId }) {
let [loading, setLoading] = useState(true);
- if (process.env.NODE_ENV === 'development') {
+ if (isDevelopmentEnvironment() || isPreviewEnvironment()) {
if (location.pathname !== '/payees') {
throw new Error(
`Possibly invalid use of ManageRulesModal, add the current url '${location.pathname}' to the allowlist if you're confident the modal can never appear on top of the '/rules' page.`