wix-incubator / vscode-glean

The extension provides refactoring tools for your React codebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Render conditionally doesn't insert { } required for JSXExpressionContainer

jedwards1211 opened this issue ยท comments

I'd recommend using JSCodeshift or at least Recast to transform the AST

Before

/**
 * @prettier
 * @flow
 */

import * as React from 'react'

export type Props = {
  
}

export default function Test(props: Props): React.Node {
  return (
    <div>
      <Foo />
    </div>
  )
}

After

/**
 * @prettier
 * @flow
 */

import * as React from 'react'

export type Props = {
  
}

export default function Test(props: Props): React.Node {
  return (
    <div>
(
true
?       <Foo />

: null
)    </div>
  )
}

same here

is there anyone this doesn't happen for? Maybe it's specific to .js files?

Hey @anhthii @jedwards1211 I was able to reproduce an issue. Im currently working on a version that will include several fixes. Including this one

๐ŸŽ‰ This issue has been resolved in version 4.20.1 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

Just release a fix. Pls validate!

@borislit It works perfectly. Thankyou!