Skip to content

Commit 7169552

Browse files
committed
fix bug3
1 parent 26f6923 commit 7169552

1 file changed

Lines changed: 4 additions & 42 deletions

File tree

src/dashboard/CustomParseOptions/CustomParseOptions.react.js

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -47,39 +47,6 @@ const CUSTOM_PAGES_KEYS = [
4747
'linkSendFail',
4848
];
4949

50-
// Whitelist of `customOptions` keys that the form actually manages. Used by
51-
// the "Reset to saved values" action to drop any stray keys the user typed
52-
// into the JSON editor.
53-
const KNOWN_CUSTOM_OPTIONS_KEYS = [
54-
'publicServerURL',
55-
'maxUploadSize',
56-
'preserveFileName',
57-
'enableSingleSchemaCache',
58-
'allowCustomObjectId',
59-
'objectIdSize',
60-
'passwordPolicy',
61-
'accountLockout',
62-
'enableAnonymousUsers',
63-
'enforcePrivateUsers',
64-
'sessionLength',
65-
'emailVerifyTokenValidityDuration',
66-
'expireInactiveSessions',
67-
...CUSTOM_PAGES_KEYS,
68-
];
69-
70-
const filterToKnownCustomOptions = (rawCustomOptions) => {
71-
const filtered = {};
72-
if (!rawCustomOptions || typeof rawCustomOptions !== 'object') {
73-
return filtered;
74-
}
75-
for (const key of KNOWN_CUSTOM_OPTIONS_KEYS) {
76-
if (Object.prototype.hasOwnProperty.call(rawCustomOptions, key)) {
77-
filtered[key] = rawCustomOptions[key];
78-
}
79-
}
80-
return filtered;
81-
};
82-
8350
// Recursively sort object keys so the JSON editor shows properties in a
8451
// deterministic, alphabetical order whenever we rebuild the text ourselves
8552
// (modal open, reset, etc.). User-driven edits bypass this, preserving caret
@@ -1384,16 +1351,11 @@ class CustomParseOptions extends DashboardView {
13841351
const resetPayload = () => {
13851352
// Revert to the original values from the most recent API response
13861353
// (stored in `initialFields`). This drops every form-level and
1387-
// JSON-editor change the user has made in this session. We still
1388-
// filter `customOptions` to keys the form actually manages so the
1389-
// editor only shows form-field properties after reset.
1354+
// JSON-editor change the user has made in this session and surfaces
1355+
// every saved key — including any the form doesn't render — so the
1356+
// editor matches the GET /parseOptions response.
13901357
const apiInitialFields = this.state.initialFields || {};
1391-
const filteredCustomOptions = filterToKnownCustomOptions(apiInitialFields.customOptions);
1392-
const flatPayload = buildFlatEditorPayload({
1393-
customOptions: filteredCustomOptions,
1394-
clientPush: apiInitialFields.clientPush,
1395-
clientClassCreation: apiInitialFields.clientClassCreation,
1396-
});
1358+
const flatPayload = buildFlatEditorPayload(apiInitialFields);
13971359
this.setState({
13981360
payloadJson: stringifyAlpha(flatPayload),
13991361
copyStatus: '',

0 commit comments

Comments
 (0)