chore: remove unnecessary comments
This commit is contained in:
@@ -14,26 +14,20 @@
|
||||
let texts = $state<Array<{ id: string; text: string }>>([]);
|
||||
let backgroundImage = $state<string | undefined>(undefined);
|
||||
|
||||
// Create a derived store for text settings to avoid cyclic dependencies
|
||||
let textSettings = $derived($textSettingsStore);
|
||||
|
||||
// Listen for text settings changes and update all panels
|
||||
let previousSettings = $state<string>("");
|
||||
|
||||
$effect(() => {
|
||||
// Only depend on the derived settings value
|
||||
const currentSettings = textSettings;
|
||||
const settingsString = JSON.stringify(currentSettings);
|
||||
|
||||
// Only update if settings actually changed
|
||||
if (settingsString !== previousSettings) {
|
||||
// Update panels with new settings
|
||||
const updatedPanels = panels.map((panel) => ({
|
||||
...panel,
|
||||
text: { ...panel.text, ...currentSettings },
|
||||
}));
|
||||
|
||||
// Use a microtask to avoid synchronous update issues
|
||||
Promise.resolve().then(() => {
|
||||
if (panels.length > 0) {
|
||||
panels = updatedPanels;
|
||||
@@ -45,14 +39,12 @@
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
// Initialize with default texts for common Twitch panels
|
||||
const defaultTexts = [
|
||||
{ id: crypto.randomUUID(), text: "About" },
|
||||
{ id: crypto.randomUUID(), text: "Links" },
|
||||
];
|
||||
texts = defaultTexts;
|
||||
|
||||
// Load background image
|
||||
try {
|
||||
const loadedBackground = await imageService.loadDefaultBackground();
|
||||
backgroundImage = loadedBackground;
|
||||
@@ -61,7 +53,6 @@
|
||||
exportService.setErrorMessage("Не удалось загрузить фоновое изображение по умолчанию");
|
||||
}
|
||||
|
||||
// Create panels from texts (with or without background)
|
||||
const initialPanels = panelService.updatePanelsFromTexts(texts, [], backgroundImage || "");
|
||||
panels = initialPanels;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user