From 4162b2d90290bbe4b72b2e12c0af6433e342275a Mon Sep 17 00:00:00 2001
From: aaronskiba <71047780+aaronskiba@users.noreply.github.com>
Date: Mon, 15 Jan 2024 16:17:00 -0700
Subject: [PATCH] Call getConstant() after constants.js callback
Prior to this commit, requiredField.js was calling getConstant('REQUIRED_FIELD_TEXT') before the constant was loaded to constants.js. As a result, `asterisk` was evaluating to `undefined`.
---
app/javascript/src/utils/requiredField.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/javascript/src/utils/requiredField.js b/app/javascript/src/utils/requiredField.js
index 6bb826a509..7a1112aeda 100644
--- a/app/javascript/src/utils/requiredField.js
+++ b/app/javascript/src/utils/requiredField.js
@@ -1,7 +1,7 @@
import getConstant from './constants';
import { isObject } from './isType';
-const asterisk = `* `;
+var asterisk;
export const addAsterisk = (el) => {
const target = $(el);
@@ -32,5 +32,6 @@ export const addAsterisks = (el) => {
};
$(() => {
+ asterisk = `* `;
addAsterisks('body');
});