Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX macros aren't working inside JSX expressions in JSX macros #1175

Closed
khmm12 opened this issue Dec 9, 2021 · 8 comments · Fixed by #1436
Closed

JSX macros aren't working inside JSX expressions in JSX macros #1175

khmm12 opened this issue Dec 9, 2021 · 8 comments · Fixed by #1436

Comments

@khmm12
Copy link

khmm12 commented Dec 9, 2021

Describe the bug

Since v3 JSX macros aren't working inside JSX expressions in JSX macros. v2 macros are working as expected.

The issue is reproducible in any nesting level.

To Reproduce

import { Trans } from '@lingui/macro'

export default function Component(props) {
  return <Trans>Hello, {props.world ? <Trans>world</Trans> : <Trans>guys</Trans>}</Trans>
}

Expected behaviour

import { Trans } from '@lingui/react'

export default function Component(props) {
  return (
    <Trans
      id='Hello, {0}'
      values={{
        0: props.world ? <Trans id='world' /> : <Trans id='guys' />
      }}
    />
  )
}

Actual behaviour

import { Trans } from '@lingui/react'

export default function Component(props) {
  return (
    <Trans
      id='Hello, {0}'
      values={{
        0: props.world ? <Trans>world</Trans> : <Trans>guys</Trans>
      }}
    />
  )
}

Additional context

  • lingui: 3.13.0
  • @babel/core: 7.16.0
@semoal
Copy link
Contributor

semoal commented Dec 9, 2021

Thx @khmm12 will take a look as soon as possible. Indeed looks a regression

@tulodzieckim-simplito
Copy link

Any news about this?

@stale
Copy link

stale bot commented Mar 27, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 27, 2022
@stale stale bot closed this as completed Apr 6, 2022
@khmm12
Copy link
Author

khmm12 commented May 26, 2022

No, still actual.

@khmm12
Copy link
Author

khmm12 commented Jun 17, 2022

Up

@timofei-iatsenko
Copy link
Collaborator

If some one takes this task, please, also check that in the SWC plugin. The test case should ported there.

@timofei-iatsenko timofei-iatsenko self-assigned this Feb 14, 2023
@timofei-iatsenko
Copy link
Collaborator

Checked this in SWC, this also don't work. I made a quick fix for 1 level of nesting for js macro. But if there would be more levels, that would break again. To fix this, fundamental changes needed. Still think how to do that.

timofei-iatsenko added a commit to timofei-iatsenko/js-lingui that referenced this issue Feb 14, 2023
timofei-iatsenko added a commit to timofei-iatsenko/js-lingui that referenced this issue Feb 14, 2023
timofei-iatsenko added a commit to timofei-iatsenko/js-lingui that referenced this issue Feb 14, 2023
@Martin005 Martin005 linked a pull request Feb 14, 2023 that will close this issue
7 tasks
timofei-iatsenko added a commit to timofei-iatsenko/js-lingui that referenced this issue Feb 14, 2023
timofei-iatsenko added a commit to timofei-iatsenko/js-lingui that referenced this issue Feb 14, 2023
timofei-iatsenko added a commit to timofei-iatsenko/js-lingui that referenced this issue Feb 15, 2023
@timofei-iatsenko
Copy link
Collaborator

fixed by #1436 and would be released with v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants