Fix phpSerialize useCallback dependency

This commit is contained in:
dwindown
2025-09-21 13:37:04 +07:00
parent 5ccb1e2421
commit e59ebcb5d3

View File

@@ -21,7 +21,7 @@ const ObjectEditor = () => {
const fileInputRef = useRef(null);
// PHP serialize implementation (reused from SerializeTool)
const phpSerialize = (data) => {
const phpSerialize = useCallback((data) => {
if (data === null) return 'N;';
if (typeof data === 'boolean') return data ? 'b:1;' : 'b:0;';
if (typeof data === 'number') {
@@ -50,7 +50,7 @@ const ObjectEditor = () => {
return result;
}
return 'N;';
};
}, []);
// PHP unserialize implementation (reused from SerializeTool)
const phpUnserialize = (str) => {
@@ -272,7 +272,7 @@ const ObjectEditor = () => {
} catch (err) {
console.error('Error generating outputs:', err);
}
}, []);
}, [phpSerialize]);
// Handle file import
const handleFileImport = (event) => {