Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist state #136

Merged
merged 20 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions webapp/src/actions/updateTranslation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ export default async function updateTranslation(
}

const projectStore = await Store.getProjectStore(projectConfig);

const messages = await projectStore.getMessages();
const messageIds = messages.map((message) => message.id);
const foundId = messageIds.find((id) => id == messageId);

if (foundId === undefined) {
throw new MessageNotFound(languageName, messageId);
amerharb marked this conversation as resolved.
Show resolved Hide resolved
}

try {
await projectStore.updateTranslation(languageName, messageId, translation);
await Store.persistToDisk();
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/dataAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function accessLanguage(
const lyraConfig = await repoGit.getLyraConfig();
const projectConfig = lyraConfig.getProjectConfigByPath(project.projectPath);
const projectStore = await Store.getProjectStore(projectConfig);
const messages = await projectStore.getMessageIds();
const messages = await projectStore.getMessages();

if (!projectConfig.isLanguageSupported(languageName)) {
throw new LanguageNotSupported(languageName, projectName);
Expand All @@ -67,7 +67,7 @@ async function readProject(project: ServerProjectConfig) {
const lyraConfig = await repoGit.getLyraConfig();
const projectConfig = lyraConfig.getProjectConfigByPath(project.projectPath);
const store = await Store.getProjectStore(projectConfig);
const messages = await store.getMessageIds();
const messages = await store.getMessages();
const languagesWithTranslations = projectConfig.languages.map(
async (lang) => {
const translations = await store.getTranslations(lang);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.