Skip to content

Commit

Permalink
Call getConstant() after constants.js callback
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
aaronskiba committed Jan 15, 2024
1 parent 8a0d0fb commit 4162b2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/javascript/src/utils/requiredField.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getConstant from './constants';
import { isObject } from './isType';

const asterisk = `<span class="red" title="${getConstant('REQUIRED_FIELD_TEXT')}">* </span>`;
var asterisk;

export const addAsterisk = (el) => {
const target = $(el);
Expand Down Expand Up @@ -32,5 +32,6 @@ export const addAsterisks = (el) => {
};

$(() => {
asterisk = `<span class="red" title="${getConstant('REQUIRED_FIELD_TEXT')}">* </span>`;
addAsterisks('body');
});

0 comments on commit 4162b2d

Please # to comment.