mirror of
https://github.com/mue/mue.git
synced 2026-07-23 08:47:19 +02:00
feat(quote): clear quote queue and cache on type change, custom quote modification, and pack installation/uninstallation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import variables from 'config/variables';
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { MdCancel, MdAdd, MdSource, MdOutlineFormatQuote } from 'react-icons/md';
|
||||
|
||||
import {
|
||||
@@ -41,6 +41,12 @@ const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
|
||||
|
||||
const [customQuote, setCustomQuote] = useState(getCustom());
|
||||
|
||||
// Clear quote queue when quote type changes
|
||||
useEffect(() => {
|
||||
localStorage.removeItem('quoteQueue');
|
||||
localStorage.removeItem('currentQuote');
|
||||
}, [quoteType]);
|
||||
|
||||
const handleCustomQuote = (e, text, index, type) => {
|
||||
const result = text === true ? e.target.value : e.target.result;
|
||||
|
||||
@@ -64,6 +70,9 @@ const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
|
||||
setCustomQuote(updatedCustomQuote);
|
||||
|
||||
localStorage.setItem('customQuote', JSON.stringify(updatedCustomQuote));
|
||||
// Clear quote queue when custom quotes are modified
|
||||
localStorage.removeItem('quoteQueue');
|
||||
localStorage.removeItem('currentQuote');
|
||||
};
|
||||
|
||||
const QUOTE_SECTION = 'modals.main.settings.sections.quote';
|
||||
|
||||
Reference in New Issue
Block a user