Reuse the same data provider as the parent JSONMap instance in order
to avoid inadvertently mangling the form data when saving the modal
edit dialog.
Fixes: bb9ede238a ("luci-base: form.js: reuse JSONMap data provider in GridSection modals")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
var m;
- if (parent instanceof CBIJSONMap)
- m = new CBIJSONMap(parent.data.data, null, null);
- else
+ if (parent instanceof CBIJSONMap) {
+ m = new CBIJSONMap(null, null, null);
+ m.data = parent.data;
+ }
+ else {
m = new CBIMap(parent.config, null, null);
+ }
var s = m.section(CBINamedSection, section_id, this.sectiontype);