feat: prevent loading components to save memory

This commit is contained in:
Nevo David 2025-07-16 21:27:03 +07:00
parent 97e82593ec
commit f88730bda8
1 changed files with 5 additions and 4 deletions

View File

@ -246,7 +246,7 @@ export const withProvider = function <T extends object>(params: {
{t('preview', 'Preview')}
</Button>
</div>
{(!!SettingsComponent || !!data?.internalPlugs?.length) && (
{current && (!!SettingsComponent || !!data?.internalPlugs?.length) && (
<div className="flex-1 flex">
<Button
onClick={() => setTab(1)}
@ -263,7 +263,7 @@ export const withProvider = function <T extends object>(params: {
)}
</div>
{(tab === 0 ||
{current && (tab === 0 ||
(!SettingsComponent && !data?.internalPlugs?.length)) &&
!value?.[0]?.content?.length && (
<div>
@ -273,8 +273,9 @@ export const withProvider = function <T extends object>(params: {
)}
</div>
)}
{(tab === 0 ||
(!SettingsComponent && !data?.internalPlugs?.length)) &&
{current &&
(tab === 0 ||
(!SettingsComponent && !data?.internalPlugs?.length)) &&
!!value?.[0]?.content?.length &&
(CustomPreviewComponent ? (
<CustomPreviewComponent