Try repeat

This commit is contained in:
Халимов Рустам
2025-12-27 23:46:13 +03:00
parent ac00068175
commit 929e071ea7
4 changed files with 299 additions and 181 deletions

View File

@@ -19,9 +19,11 @@ const App = () => {
cornerRadius: 4,
});
// ВАЖНО: Инициализируем subdivisions пустым объектом
const [splits, setSplits] = useState<LayoutSplits>({
x: [],
y: []
y: [],
subdivisions: {}
});
// --- ЛОГИКА ВОССТАНОВЛЕНИЯ ИЗ ССЫЛКИ ---
@@ -29,7 +31,11 @@ const App = () => {
const sharedData = parseShareUrl();
if (sharedData) {
setConfig(sharedData.config);
setSplits(sharedData.splits);
// При восстановлении тоже гарантируем наличие subdivisions
setSplits({
...sharedData.splits,
subdivisions: sharedData.splits.subdivisions || {}
});
setStep(3);
setIsLoadedFromUrl(true);
window.history.replaceState({}, '', window.location.pathname);
@@ -122,7 +128,7 @@ const App = () => {
<button
onClick={() => {
setStep(1);
setSplits({x: [], y: []});
setSplits({x: [], y: [], subdivisions: {}}); // Сброс всего
window.history.replaceState({}, '', window.location.pathname);
}}
className="flex items-center gap-2 px-6 py-3 rounded-lg font-semibold text-gray-400 hover:text-white transition-colors border border-transparent hover:border-slate-700"