Skip to content

Commit

Permalink
Fix edge case of nested Translate component
Browse files Browse the repository at this point in the history
  • Loading branch information
rtsao committed Aug 9, 2023
1 parent 38c31ab commit a415913
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fixtures/i18n-var-translate-component/code.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Translate } from "fusion-plugin-i18n-react";

const Foo = <Translate id="foo" />;

const Bar = <Foo renderProp={() => <Translate id="bar" />} />
2 changes: 2 additions & 0 deletions fixtures/i18n-var-translate-component/output.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import _fusionPluginI18nChunkTranslationMap from "virtual:fusion-vite-i18n-map";
import { Translate } from "fusion-plugin-i18n-react";
const Foo = <Translate id="foo" />;
const Bar = <Foo prop={()=><Translate id="bar"/>}/>;
_fusionPluginI18nChunkTranslationMap.add("/path/to/file.js", [
"vite-i18n-chunk"
], [
"bar",
"foo"
]);
1 change: 1 addition & 0 deletions packages/fusion/transform/src/i18n/analyze_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl Visit for Analyzer<'_> {
}

fn visit_jsx_opening_element(&mut self, opening_element: &JSXOpeningElement) {
opening_element.visit_children_with(self);
match &opening_element.name {
JSXElementName::Ident(ident) => {
if self
Expand Down

0 comments on commit a415913

Please sign in to comment.