Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Segu-g committed May 27, 2024
1 parent 51b542f commit 82706e2
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 71 deletions.
28 changes: 14 additions & 14 deletions src/store/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
const allDict = await Promise.all(
state.engineIds.map((engineId) => {
return actions.LOAD_USER_DICT({ engineId });
})
}),
);
const mergedDictMap = new Map<string, [string, UserDictWord]>();
for (const dict of allDict) {
Expand All @@ -64,7 +64,7 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
ADD_WORD: {
async action(
{ state, actions },
{ surface, pronunciation, accentType, priority }
{ surface, pronunciation, accentType, priority },
) {
// 同じ単語IDで登録するために、1つのエンジンで登録したあと全エンジンに同期する。
const engineId: EngineId | undefined = state.engineIds[0];
Expand All @@ -81,7 +81,7 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
pronunciation,
accentType,
priority,
})
}),
);

await actions.SYNC_ALL_USER_DICT();
Expand All @@ -91,7 +91,7 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
REWRITE_WORD: {
async action(
{ state, actions },
{ wordUuid, surface, pronunciation, accentType, priority }
{ wordUuid, surface, pronunciation, accentType, priority },
) {
if (state.engineIds.length === 0)
throw new Error(`At least one engine must be registered`);
Expand All @@ -107,7 +107,7 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
pronunciation,
accentType,
priority,
})
}),
);
}
},
Expand All @@ -125,7 +125,7 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
.then((instance) =>
instance.invoke("deleteUserDictWordUserDictWordWordUuidDelete")({
wordUuid,
})
}),
);
}
},
Expand All @@ -144,9 +144,9 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
async (instance) =>
new Set(
Object.keys(
await instance.invoke("getUserDictWordsUserDictGet")({})
)
)
await instance.invoke("getUserDictWordsUserDictGet")({}),
),
),
);
if (Object.keys(mergedDict).some((id) => !dictIdSet.has(id))) {
await actions
Expand All @@ -161,9 +161,9 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
Object.entries(mergedDict).map(([k, v]) => [
k,
UserDictWordToJSON(v),
])
]),
),
})
}),
);
}
const removedDictIdSet = new Set(dictIdSet);
Expand All @@ -184,9 +184,9 @@ export const dictionaryStore = createPartialStore<DictionaryStoreTypes>({
instance.invoke("deleteUserDictWordUserDictWordWordUuidDelete")(
{
wordUuid: id,
}
)
)
},
),
),
);
});
}
Expand Down
Loading

0 comments on commit 82706e2

Please sign in to comment.