Skip to content

Commit

Permalink
fix: prevent empty strings in cache (#3324)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Apr 10, 2024
1 parent 277ed51 commit dbde5da
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 145 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -13,6 +13,7 @@
"test": "turbo run test --cache-dir='.turbo' -- --runInBand && npm run testRoot -- --runInBand",
"testRoot": "jest",
"eslint": "eslint --ext .ts --ext .tsx --max-warnings 0 .",
"dev:web": "turbo run dev --parallel --no-deps --include-dependencies --cache-dir='.turbo' --scope='@tolgee/web'",
"develop": "turbo run develop --parallel --include-dependencies --cache-dir='.turbo'",
"develop:web": "npm run develop -- --scope=@tolgee/web-testapp",
"develop:react": "npm run develop -- --scope=@tolgee/react-testapp",
Expand Down Expand Up @@ -65,7 +66,7 @@
"prettier-plugin-svelte": "3.2.2",
"semantic-release": "^21.0.6",
"ts-node": "^10.9.1",
"turbo": "1.10.12",
"turbo": "1.13.2",
"typescript": "^4.9.5"
},
"commitlint": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Expand Up @@ -38,6 +38,7 @@
"clean": "rm -rf dist lib",
"test": "jest --collect-coverage",
"develop": "concurrently \"rollup -c rollup.config.js -w\" \"tsc --declaration --emitDeclarationOnly --watch --preserveWatchOutput --project tsconfig.prod.json\" ",
"dev": "npm run develop",
"tsc": "tsc --noEmit"
},
"author": "Tolgee",
Expand Down
22 changes: 12 additions & 10 deletions packages/web/src/package/ui/KeyDialog/dialogContext/tools.ts
Expand Up @@ -38,16 +38,18 @@ export const changeInTolgeeCache = (
values: [language: string, value: string][],
changeTranslation: ChangeTranslationInterface
) => {
const changers = values.map(([language, value]) =>
changeTranslation(
{
language,
namespace: ns,
},
key,
value
)
);
const changers = values
.filter(([_, value]) => Boolean(value))
.map(([language, value]) =>
changeTranslation(
{
language,
namespace: ns,
},
key,
value
)
);
return { revert: () => changers.forEach((ch) => ch.revert()) };
};

Expand Down

0 comments on commit dbde5da

Please sign in to comment.