mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
Fixed overwritten theme duplication in ThemeList (#18405)
refs https://www.notion.so/ghost/AdminX-feedback-27fc7f549bbf4a53bfa2e7b6e5643963?p=6a295239a38840f18b0a3b1710095074&pm=s - There was an issue where an overwritten theme would be included in the themes array twice when passed to the ThemeList component. - We now remove the initial theme from the array when overwriting to avoid duplications. --- <!-- Leave the line below if you'd like GitHub Copilot to generate a summary from your commit --> <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 1260615</samp> This pull request refactors the theme problem view component to make it reusable and fixes a bug with theme name display in the theme modal. It affects the files `InvalidThemeModal.tsx` and `ThemeModal.tsx` in the admin-x-settings app.
This commit is contained in:
parent
f5b2bdd41e
commit
9ae2e24315
2 changed files with 7 additions and 1 deletions
|
@ -95,6 +95,12 @@ const ThemeToolbar: React.FC<ThemeToolbarProps> = ({
|
|||
okColor: 'red',
|
||||
onOk: async (confirmModal) => {
|
||||
setUploading(true);
|
||||
|
||||
// this is to avoid the themes array from returning the overwritten theme.
|
||||
// find index of themeFileName in existingThemeNames and remove from the array
|
||||
const index = existingThemeNames.indexOf(themeFileName);
|
||||
themes.splice(index, 1);
|
||||
|
||||
await handleThemeUpload({file, onActivate: onClose});
|
||||
setUploading(false);
|
||||
setCurrentTab('installed');
|
||||
|
|
|
@ -13,7 +13,7 @@ type FatalError = {
|
|||
};
|
||||
};
|
||||
|
||||
type FatalErrors = FatalError[];
|
||||
type FatalErrors = FatalError[];
|
||||
|
||||
export const ThemeProblemView = ({problem}:{problem: ThemeProblem}) => {
|
||||
const [isExpanded, setExpanded] = useState(false);
|
||||
|
|
Loading…
Add table
Reference in a new issue