chore: compute only if value

This commit is contained in:
Ibrahima G. Coulibaly
2025-02-27 13:11:02 +00:00
parent 8d3b0b3840
commit 88a6cfd2fb
2 changed files with 14 additions and 15 deletions

27
.idea/workspace.xml generated
View File

@@ -4,9 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="feat: json pretty">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/home/Categories.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/home/Categories.tsx" afterDir="false" />
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="style: tool categories">
<change beforePath="$PROJECT_DIR$/src/pages/tools/json/prettify/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/json/prettify/index.tsx" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -263,14 +262,6 @@
<workItem from="1740584243965" duration="17000" />
<workItem from="1740613094492" duration="9615000" />
</task>
<task id="LOCAL-00082" summary="fix: ci">
<option name="closed" value="true" />
<created>1719588854025</created>
<option name="number" value="00082" />
<option name="presentableId" value="LOCAL-00082" />
<option name="project" value="LOCAL" />
<updated>1719588854025</updated>
</task>
<task id="LOCAL-00083" summary="fix: ci">
<option name="closed" value="true" />
<created>1719589144843</created>
@@ -655,7 +646,15 @@
<option name="project" value="LOCAL" />
<updated>1740661540908</updated>
</task>
<option name="localTasksCounter" value="131" />
<task id="LOCAL-00131" summary="style: tool categories">
<option name="closed" value="true" />
<created>1740661744828</created>
<option name="number" value="00131" />
<option name="presentableId" value="LOCAL-00131" />
<option name="project" value="LOCAL" />
<updated>1740661744828</updated>
</task>
<option name="localTasksCounter" value="132" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -714,7 +713,6 @@
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="feat: shuffle ui" />
<MESSAGE value="refactor: remove validation schema" />
<MESSAGE value="refactor: optimize imports" />
<MESSAGE value="chore: use string tools" />
@@ -739,7 +737,8 @@
<MESSAGE value="refact: examples" />
<MESSAGE value="fix: examples" />
<MESSAGE value="feat: json pretty" />
<option name="LAST_COMMIT_MESSAGE" value="feat: json pretty" />
<MESSAGE value="style: tool categories" />
<option name="LAST_COMMIT_MESSAGE" value="style: tool categories" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View File

@@ -122,7 +122,7 @@ export default function PrettifyJson({ title }: ToolComponentProps) {
const formRef = useRef<FormikProps<InitialValuesType>>(null);
const compute = (optionsValues: InitialValuesType, input: any) => {
const { indentationType, spacesCount } = optionsValues;
setResult(beautifyJson(input, indentationType, spacesCount));
if (input) setResult(beautifyJson(input, indentationType, spacesCount));
};
const getGroups: GetGroupsType<InitialValuesType> = ({