You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to unminify certain jsxs JSX code, I encountered an issue where the output does not correctly reflect the original structure. Specifically, a piece of code in module-63390.js seems to improperly handle the conditional selection of tags ("a" or "div").
Input code
Unminifying this source (Ref), and looking at module-63390.js
Reproduction
No response
Steps to reproduce
Unminify the source code (Ref) and inspect module-63390.js.
Observe the handling of the conditional tag selection, especially in the jsxs(url ? "a" : "div", {...}) part.
Expected behavior
Running it through ChatGPT, it suggested that a canonical way to implement that pattern would be to seperate the ternary out from the main JSX block into a 'helper tag', similar to this:
// Helper function for conditionally setting tag typeconstTag=url ? 'a' : 'div';// Dynamic class namesconstclassNames=Z$0("flex h-full w-full flex-col overflow-hidden rounded-md border border-black/10 bg-gray-50 shadow-[0_2px_24px_rgba(0,0,0,0.05)]",className);return(<TagclassName={classNames}href={url}target={url ? "_blank" : ""}onClick={h}>
//..snip..
While I haven't looked deeply into it, I suspect that perhaps this part that conditionally chooses which tag to use is possibly confusing the unminify?
jsxs(url ? "a" : "div",{
The text was updated successfully, but these errors were encountered:
Originally shared in #36 (comment)
Describe the bug
When attempting to unminify certain
jsxs
JSX code, I encountered an issue where the output does not correctly reflect the original structure. Specifically, a piece of code inmodule-63390.js
seems to improperly handle the conditional selection of tags ("a"
or"div"
).Input code
Unminifying this source (Ref), and looking at
module-63390.js
Reproduction
No response
Steps to reproduce
module-63390.js
.jsxs(url ? "a" : "div", {...})
part.Expected behavior
Running it through ChatGPT, it suggested that a canonical way to implement that pattern would be to seperate the ternary out from the main JSX block into a 'helper tag', similar to this:
Actual behavior
Source (unpacked)
Transformed (unminified)
While I haven't looked deeply into it, I suspect that perhaps this part that conditionally chooses which tag to use is possibly confusing the unminify?
The text was updated successfully, but these errors were encountered: