fix: Page list not refreshing and dialog styling
- Fix api response handling in pages query (api returns JSON directly) - Fix page-structure query response handling - Add theme class copying to dialog portal for proper CSS variable inheritance - Portal container now syncs with document theme (light/dark)
This commit is contained in:
@@ -40,7 +40,17 @@ const DialogContent = React.forwardRef<
|
||||
if (!portalRoot) {
|
||||
portalRoot = document.createElement('div');
|
||||
portalRoot.id = 'woonoow-dialog-portal';
|
||||
// Copy theme class from documentElement for proper CSS variable inheritance
|
||||
const themeClass = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
|
||||
portalRoot.className = themeClass;
|
||||
appContainer.appendChild(portalRoot);
|
||||
} else {
|
||||
// Update theme class in case it changed
|
||||
const themeClass = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
|
||||
if (!portalRoot.classList.contains(themeClass)) {
|
||||
portalRoot.classList.remove('light', 'dark');
|
||||
portalRoot.classList.add(themeClass);
|
||||
}
|
||||
}
|
||||
return portalRoot;
|
||||
};
|
||||
|
||||
@@ -51,8 +51,9 @@ export default function AppearancePages() {
|
||||
const { data: pages = [], isLoading: pagesLoading } = useQuery<PageItem[]>({
|
||||
queryKey: ['pages'],
|
||||
queryFn: async () => {
|
||||
// api.get returns JSON directly (not wrapped in { data: ... })
|
||||
const response = await api.get('/pages');
|
||||
return response.data;
|
||||
return response; // Return response directly
|
||||
},
|
||||
});
|
||||
|
||||
@@ -64,8 +65,9 @@ export default function AppearancePages() {
|
||||
const endpoint = selectedPage.type === 'page'
|
||||
? `/pages/${selectedPage.slug}`
|
||||
: `/templates/${selectedPage.cpt}`;
|
||||
// api.get returns JSON directly
|
||||
const response = await api.get(endpoint);
|
||||
return response.data;
|
||||
return response; // Return response directly
|
||||
},
|
||||
enabled: !!selectedPage,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user