Skip to content

Commit

Permalink
Always return crate search index as Map
Browse files Browse the repository at this point in the history
  • Loading branch information
Folyd committed Jun 23, 2024
1 parent 3597c31 commit 53efe34
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions extension/crate-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class CrateDocManager {
static async getCrateSearchIndex(name) {
let searchIndex = await storage.getItem(`@${name}`);
if (searchIndex) {
return searchIndex;
return new Map(searchIndex);
} else {
let crates = await CrateDocManager.getCrates();
let crate = Object.entries(crates).find(([_, { crateName }]) => crateName == name);
Expand All @@ -43,8 +43,6 @@ export default class CrateDocManager {
// 2. https://docs.rs/md-5/0.10.5/md5/
//
// Here is the rule: https://docs.rs/{crateName}/{crateVersion}/{libName}
//
// The caller should ensure `searchIndex` is a Map, not a Object.
static async addCrate({ libName, crateVersion, crateTitle, searchIndex, crateName, descShards }) {
await storage.setItem(`@${libName}`, searchIndex);
let doc = crateTitle;
Expand Down

0 comments on commit 53efe34

Please sign in to comment.