fix: preserve value types in extraFields (no string coercion)
CI / typecheck + build (turbo) (push) Canceled after 0s

- DocumentMeta.extraFields type -> Record<string, unknown>
- API routes pass extraFields through without JSON.stringify coercion
- CustomFieldBadges auto-styles by value type/content (number->purple, boolean->green/red, etc.)
- DocForm help text: generic (no hardcoded field examples)
This commit is contained in:
asepharyana
2026-08-21 00:45:32 +07:00
parent edbd812c30
commit ceb53adba4
5 changed files with 27 additions and 14 deletions
+3 -3
View File
@@ -24,15 +24,15 @@ const STANDARD_FIELDS = new Set([
function splitPayload(body: Record<string, unknown>): {
standard: Record<string, unknown>;
extraFields: Record<string, string>;
extraFields: Record<string, unknown>;
} {
const standard: Record<string, unknown> = {};
const extraFields: Record<string, string> = {};
const extraFields: Record<string, unknown> = {};
for (const [key, value] of Object.entries(body)) {
if (STANDARD_FIELDS.has(key)) {
standard[key] = value;
} else if (value !== undefined && value !== null) {
extraFields[key] = typeof value === "string" ? value : JSON.stringify(value);
extraFields[key] = value;
}
}
return { standard, extraFields };