Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
samijaber committed Oct 24, 2024
1 parent cef425b commit 7162756
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ export function usePrevious(value) {
function MyPreviousComponent(props) {
const state = useBuilderState({ count: 0 });

const prevCount = useRef(count);
const prevCount = useRef(state.count);

useEffect(() => {
prevCount.current = state.count;
Expand Down Expand Up @@ -1599,24 +1599,22 @@ function MyBasicForNoTagRefComponent(props) {
const state = useBuilderState({
name: \\"VincentW\\",
TagName: \\"div\\",
tag: \\"span\\",
get TagNameGetter() {
return \\"span\\";
},
Tag: \\"span\\",
});

const TagNameGetterRef = state.TagNameGetter;

return (
<TagNameGetterRef>
Hello <Tag>{state.name}</Tag>
<state.TagNameGetter>
Hello <state.tag>{state.name}</state.tag>
{props.actions?.map((action) => (
<TagName>
<state.TagName>
<action.icon />
<span>{action.text}</span>
</TagName>
</state.TagName>
))}
</TagNameGetterRef>
</state.TagNameGetter>
);
}

Expand Down Expand Up @@ -2765,15 +2763,12 @@ function RenderBlock(props) {
componentInfo: null,
});

const RenderComponentTagRef = state.renderComponentTag;
const TagRef = state.tag;

return (
<>
{state.shouldWrap ? (
<>
{isEmptyHtmlElement(state.tag) ? (
<TagRef {...state.attributes} {...state.actions} />
<state.tag {...state.attributes} {...state.actions} />
) : null}
{!isEmptyHtmlElement(state.tag) && state.repeatItemData ? (
<>
Expand All @@ -2787,8 +2782,8 @@ function RenderBlock(props) {
</>
) : null}
{!isEmptyHtmlElement(state.tag) && !state.repeatItemData ? (
<TagRef {...state.attributes} {...state.actions}>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.tag {...state.attributes} {...state.actions}>
<state.renderComponentTag {...state.renderComponentProps} />
{state.childrenWithoutParentComponent?.map((child) => (
<RenderBlock
key={\\"render-block-\\" + child.id}
Expand All @@ -2803,12 +2798,12 @@ function RenderBlock(props) {
context={state.childrenContext}
/>
))}
</TagRef>
</state.tag>
) : null}
</>
) : (
<>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.renderComponentTag {...state.renderComponentProps} />
</>
)}
</>
Expand Down Expand Up @@ -3914,7 +3909,7 @@ export function usePrevious<T>(value: T) {
function MyPreviousComponent(props: Props) {
const state = useBuilderState({ count: 0 });

const prevCount = useRef(count);
const prevCount = useRef(state.count);

useEffect(() => {
prevCount.current = state.count;
Expand Down Expand Up @@ -5311,24 +5306,22 @@ function MyBasicForNoTagRefComponent(props: any) {
const state = useBuilderState({
name: \\"VincentW\\",
TagName: \\"div\\",
tag: \\"span\\",
get TagNameGetter() {
return \\"span\\";
},
Tag: \\"span\\",
});

const TagNameGetterRef = state.TagNameGetter;

return (
<TagNameGetterRef>
Hello <Tag>{state.name}</Tag>
<state.TagNameGetter>
Hello <state.tag>{state.name}</state.tag>
{props.actions?.map((action) => (
<TagName>
<state.TagName>
<action.icon />
<span>{action.text}</span>
</TagName>
</state.TagName>
))}
</TagNameGetterRef>
</state.TagNameGetter>
);
}

Expand Down Expand Up @@ -6600,15 +6593,12 @@ function RenderBlock(props: RenderBlockProps) {
componentInfo: null,
});

const RenderComponentTagRef = state.renderComponentTag;
const TagRef = state.tag;

return (
<>
{state.shouldWrap ? (
<>
{isEmptyHtmlElement(state.tag) ? (
<TagRef {...state.attributes} {...state.actions} />
<state.tag {...state.attributes} {...state.actions} />
) : null}
{!isEmptyHtmlElement(state.tag) && state.repeatItemData ? (
<>
Expand All @@ -6622,8 +6612,8 @@ function RenderBlock(props: RenderBlockProps) {
</>
) : null}
{!isEmptyHtmlElement(state.tag) && !state.repeatItemData ? (
<TagRef {...state.attributes} {...state.actions}>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.tag {...state.attributes} {...state.actions}>
<state.renderComponentTag {...state.renderComponentProps} />
{state.childrenWithoutParentComponent?.map((child) => (
<RenderBlock
key={\\"render-block-\\" + child.id}
Expand All @@ -6638,12 +6628,12 @@ function RenderBlock(props: RenderBlockProps) {
context={state.childrenContext}
/>
))}
</TagRef>
</state.tag>
) : null}
</>
) : (
<>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.renderComponentTag {...state.renderComponentProps} />
</>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ export function usePrevious(value) {
function MyPreviousComponent(props) {
const state = useLocalObservable(() => ({ count: 0 }));

const prevCount = useRef(count);
const prevCount = useRef(state.count);

useEffect(() => {
prevCount.current = state.count;
Expand Down Expand Up @@ -1632,24 +1632,22 @@ function MyBasicForNoTagRefComponent(props) {
const state = useLocalObservable(() => ({
name: \\"VincentW\\",
TagName: \\"div\\",
tag: \\"span\\",
get TagNameGetter() {
return \\"span\\";
},
Tag: \\"span\\",
}));

const TagNameGetterRef = state.TagNameGetter;

return (
<TagNameGetterRef>
Hello <Tag>{state.name}</Tag>
<state.TagNameGetter>
Hello <state.tag>{state.name}</state.tag>
{props.actions?.map((action) => (
<TagName>
<state.TagName>
<action.icon />
<span>{action.text}</span>
</TagName>
</state.TagName>
))}
</TagNameGetterRef>
</state.TagNameGetter>
);
}

Expand Down Expand Up @@ -2813,15 +2811,12 @@ function RenderBlock(props) {
componentInfo: null,
}));

const RenderComponentTagRef = state.renderComponentTag;
const TagRef = state.tag;

return (
<>
{state.shouldWrap ? (
<>
{isEmptyHtmlElement(state.tag) ? (
<TagRef {...state.attributes} {...state.actions} />
<state.tag {...state.attributes} {...state.actions} />
) : null}
{!isEmptyHtmlElement(state.tag) && state.repeatItemData ? (
<>
Expand All @@ -2835,8 +2830,8 @@ function RenderBlock(props) {
</>
) : null}
{!isEmptyHtmlElement(state.tag) && !state.repeatItemData ? (
<TagRef {...state.attributes} {...state.actions}>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.tag {...state.attributes} {...state.actions}>
<state.renderComponentTag {...state.renderComponentProps} />
{state.childrenWithoutParentComponent?.map((child) => (
<RenderBlock
key={\\"render-block-\\" + child.id}
Expand All @@ -2851,12 +2846,12 @@ function RenderBlock(props) {
context={state.childrenContext}
/>
))}
</TagRef>
</state.tag>
) : null}
</>
) : (
<>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.renderComponentTag {...state.renderComponentProps} />
</>
)}
</>
Expand Down Expand Up @@ -3968,7 +3963,7 @@ export function usePrevious<T>(value: T) {
function MyPreviousComponent(props: Props) {
const state = useLocalObservable(() => ({ count: 0 }));

const prevCount = useRef(count);
const prevCount = useRef(state.count);

useEffect(() => {
prevCount.current = state.count;
Expand Down Expand Up @@ -5367,24 +5362,22 @@ function MyBasicForNoTagRefComponent(props: any) {
const state = useLocalObservable(() => ({
name: \\"VincentW\\",
TagName: \\"div\\",
tag: \\"span\\",
get TagNameGetter() {
return \\"span\\";
},
Tag: \\"span\\",
}));

const TagNameGetterRef = state.TagNameGetter;

return (
<TagNameGetterRef>
Hello <Tag>{state.name}</Tag>
<state.TagNameGetter>
Hello <state.tag>{state.name}</state.tag>
{props.actions?.map((action) => (
<TagName>
<state.TagName>
<action.icon />
<span>{action.text}</span>
</TagName>
</state.TagName>
))}
</TagNameGetterRef>
</state.TagNameGetter>
);
}

Expand Down Expand Up @@ -6662,15 +6655,12 @@ function RenderBlock(props: RenderBlockProps) {
componentInfo: null,
}));

const RenderComponentTagRef = state.renderComponentTag;
const TagRef = state.tag;

return (
<>
{state.shouldWrap ? (
<>
{isEmptyHtmlElement(state.tag) ? (
<TagRef {...state.attributes} {...state.actions} />
<state.tag {...state.attributes} {...state.actions} />
) : null}
{!isEmptyHtmlElement(state.tag) && state.repeatItemData ? (
<>
Expand All @@ -6684,8 +6674,8 @@ function RenderBlock(props: RenderBlockProps) {
</>
) : null}
{!isEmptyHtmlElement(state.tag) && !state.repeatItemData ? (
<TagRef {...state.attributes} {...state.actions}>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.tag {...state.attributes} {...state.actions}>
<state.renderComponentTag {...state.renderComponentProps} />
{state.childrenWithoutParentComponent?.map((child) => (
<RenderBlock
key={\\"render-block-\\" + child.id}
Expand All @@ -6700,12 +6690,12 @@ function RenderBlock(props: RenderBlockProps) {
context={state.childrenContext}
/>
))}
</TagRef>
</state.tag>
) : null}
</>
) : (
<>
<RenderComponentTagRef {...state.renderComponentProps} />
<state.renderComponentTag {...state.renderComponentProps} />
</>
)}
</>
Expand Down
Loading

0 comments on commit 7162756

Please sign in to comment.