Comments (9)
Hi @breagol37, once I find some time to test this it will land in a release.
@kevinchappell I think the change to render() keeps any possible BC change to a minimum. I'll also look at moving the mi18n.init higher up in the formRender constructor to get the request going ASAP.
from formbuilder.
Can you please provide a custom control script and lang file to reproduce the issue.
from formbuilder.
Thanks added above but as text files as could not upload as js or lang.
from formbuilder.
Hi @breagol37, thank you. I will take a look.
from formbuilder.
Thank you @lucasnetau
from formbuilder.
HI @breagol37
The issue occurs because the formRender render() function does not wait for the translation library to be ready.
This patch fixes your issue but render() is not meant to be async and breaks the Jest tests and possibly a BC break.
@kevinchappell Thoughts on this one? formBuilder aways the mi18n library to initialise, formRender does not.
diff --git a/src/js/form-render.js b/src/js/form-render.js
index 8331960..4a79197 100644
--- a/src/js/form-render.js
+++ b/src/js/form-render.js
@@ -67,8 +67,9 @@ class FormRender {
//Override any sanitizer configuration
setSanitizerConfig(this.options.sanitizerOptions)
+ this.mi18nLoading = null
if (!mi18n.current) {
- mi18n.init(this.options.i18n)
+ this.mi18nLoading = mi18n.init(this.options.i18n)
}
// parse any passed formData
@@ -186,7 +187,7 @@ class FormRender {
* @param {number} instanceIndex - instance index
* @return {Object} rendered form
*/
- render(element = null, instanceIndex = 0) {
+ async render(element = null, instanceIndex = 0) {
const formRender = this
const opts = this.options
element = this.getElement(element)
@@ -197,6 +198,11 @@ class FormRender {
}
}
+ if (this.mi18nLoading) {
+ await this.mi18nLoading
+ this.mi18nLoading = null
+ }
+
// Begin the core plugin
const rendered = []
from formbuilder.
@lucasnetau this is a good patch. My only doubt is if we should await all of formRender or just the render method.
Await only render method may have least impact though so let's go with your solution.
from formbuilder.
Thanks for looking into this so quickly @lucasnetau greatly appreciated.
from formbuilder.
@lucasnetau Will that fix be put into a release?
from formbuilder.
Related Issues (20)
- Text Area Component allows input of negative value in the Rows field HOT 2
- When Select component only has x2 options a non-functioning Remove Element button is still present HOT 1
- Can I provide custom order(alphabetical) to the fields? HOT 6
- How to custom label header ? HOT 2
- Adding field type button - Label not set HOT 2
- Vue 2: Uncaught TypeError: $(...).formBuilder is not a function HOT 9
- form-builder.js clears inputted data for tinymce fields when editing the field's options
- Required Checkbox Group - Other with text box - not validating blank value
- Form builder questions - Issue with data are not saving while edit/update the form builder questions HOT 4
- BeforeRemove event HOT 2
- How to keep the default class as className. HOT 1
- How to scroll to edit panels when opening them? HOT 5
- How to create a checkbox group with monetry value to each checkbox. HOT 2
- How to make bootstrap classes not disappear when removing a field from a row and putting it in an empty place HOT 8
- Labels for fields and replaceFields options do not use localized strings HOT 4
- Form render error with custom controls HOT 4
- npm plugin system HOT 1
- How to custom multiple input in one field and set the JSON output is array or object? HOT 2
- When Double-click trumbowyg area will open the Edit issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formbuilder.