Skip to content

Commit

Permalink
Merge pull request #9527 from OEvgeny/fix/packages-readme
Browse files Browse the repository at this point in the history
fix: package manager readme display in sidebar and modal
  • Loading branch information
OEvgeny authored Mar 28, 2023
2 parents 6b6b0cd + 3ae40d1 commit 8628464
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions extensions/packageManager/src/pages/Library.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const Library: React.FC = () => {
};

const getReadmeAPI = (packageName: string) => {
return httpClient.get(`${API_ROOT}/readme/${packageName}`);
return httpClient.get(`${API_ROOT}/readme/${encodeURIComponent(packageName)}`);
};

const uninstallComponentAPI = (projectId: string, packageName: string) => {
Expand Down Expand Up @@ -446,15 +446,15 @@ const Library: React.FC = () => {
setWorking('');
updateInstalledComponents(results.data.components);

await reloadProject();

// find newly installed item
// and pop up the readme if one exists.
const newItem = results.data.components.find((i) => i.name === packageName);
if (newItem?.readme) {
setSelectedItem(newItem);
setReadmeHidden(false);
}

await reloadProject();
}
} catch (err) {
telemetryClient.track('PackageInstallFailed', { package: packageName, version: version, isUpdate: isUpdating });
Expand Down Expand Up @@ -631,7 +631,7 @@ const Library: React.FC = () => {
{selectedItem && (
<DisplayMarkdownDialog
content={selectedItem?.readme}
hidden={readmeHidden}
hidden={readmeHidden || !selectedItem?.readme}
title={'Project Readme'}
onDismiss={() => {
setReadmeHidden(true);
Expand Down

0 comments on commit 8628464

Please sign in to comment.