Try repeat
This commit is contained in:
12
src/App.tsx
12
src/App.tsx
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user