Skip to content

Commit

Permalink
fix: import lg/lu not find all up view (microsoft#6238)
Browse files Browse the repository at this point in the history
* resolve correct file

* indent on import item

* lint

* change icon, no indent

Co-authored-by: Dong Lei <donglei@microsoft.com>
  • Loading branch information
zhixzhan and boydc2014 authored Mar 8, 2021
1 parent 5c62de1 commit 8fddebd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ export const ProjectTree: React.FC<Props> = ({
key={`lg_${item.id}`}
dialogName={dialog.displayName}
extraSpace={INDENT_PER_LEVEL}
icon={icons.LG}
icon={icons.DIALOG}
isActive={doesLinkMatch(link, selectedLink)}
isMenuOpen={isMenuOpen}
link={link}
Expand Down Expand Up @@ -571,7 +571,7 @@ export const ProjectTree: React.FC<Props> = ({
key={`lu_${item.id}`}
dialogName={dialog.displayName}
extraSpace={INDENT_PER_LEVEL}
icon={icons.LU}
icon={icons.DIALOG}
isActive={doesLinkMatch(link, selectedLink)}
isMenuOpen={isMenuOpen}
link={link}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const CodeEditor: React.FC<CodeEditorProps> = (props) => {

const file: LgFile | undefined = lgFileId
? lgFiles.find(({ id }) => id === lgFileId)
: lgFiles.find(({ id }) => id === `${dialogId}.${locale}`);
: lgFiles.find(({ id }) => id === dialogId || id === `${dialogId}.${locale}`);

const defaultLangFile = lgFileId
? lgFiles.find(({ id }) => id === lgFileId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const TableView: React.FC<TableViewProps> = (props) => {

const file = lgFileId
? lgFiles.find(({ id }) => id === lgFileId)
: lgFiles.find(({ id }) => id === `${dialogId}.${locale}`);
: lgFiles.find(({ id }) => id === dialogId || id === `${dialogId}.${locale}`);

const defaultLangFile = lgFileId
? lgFiles.find(({ id }) => id === lgFileId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const CodeEditor: React.FC<CodeEditorProps> = (props) => {

const file = luFileId
? luFiles.find(({ id }) => id === luFileId)
: luFiles.find(({ id }) => id === `${dialogId}.${locale}`);
: luFiles.find(({ id }) => id === dialogId || id === `${dialogId}.${locale}`);

const defaultLangFile = luFileId
? luFiles.find(({ id }) => id === luFileId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const TableView: React.FC<TableViewProps> = (props) => {

const file = luFileId
? luFiles.find(({ id }) => id === luFileId)
: luFiles.find(({ id }) => id === `${dialogId}.${locale}`);
: luFiles.find(({ id }) => id === dialogId || id === `${dialogId}.${locale}`);

const defaultLangFile = luFileId
? luFiles.find(({ id }) => id === luFileId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ export const getLanguageFileImports = <T extends LgFile | LuFile | QnAFile>(
continue;
}
const currentImports = file.imports.map((item) => {
const importedFile = getFile(getBaseName(item.id));
return {
displayName: item.description,
importPath: item.path,
id: getBaseName(item.id),
id: importedFile ? importedFile.id : '',
};
});

Expand All @@ -62,7 +63,7 @@ export const lgImportsSelectorFamily = selectorFamily<LanguageFileImport[], { pr
get(lgFilesSelectorFamily(projectId)).find((f) => f.id === fileId || f.id === `${fileId}.${locale}`) as LgFile;

// Have to exclude common as a special case
return getLanguageFileImports(dialogId, getFile).filter((i) => i.id !== 'common');
return getLanguageFileImports(dialogId, getFile).filter((i) => getBaseName(i.id) !== 'common');
},
});

Expand Down

0 comments on commit 8fddebd

Please sign in to comment.