Skip to content

Commit

Permalink
Merge pull request #2463 from opral/parjs-45--not-being-cleared
Browse files Browse the repository at this point in the history
Document page-data sideeffect quirk
  • Loading branch information
LorisSigrist authored Mar 25, 2024
2 parents 902acac + 5083daa commit 2b265b2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/mighty-brooms-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@inlang/paraglide-js-adapter-unplugin": patch
"@inlang/paraglide-js": patch
---

fix `openRepository` crash in non-git environments
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export async function load({ depends }) {

1. Links in the same Layout Component as `<ParagldieJS>` will not be translated. This will also log a warngin in development.
2. Messages are not reactive. Don't use them in server-side module scope.
3. Sideeffects triggered by `data` will run on language changes even if the data didn't change. If the data is language-dependent the sideeffect will run twice.

### Using messages in `+layout.svelte`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const paraglide = createUnplugin((config: UserConfig) => {

const repoRoot = await findRepoRoot({ nodeishFs: fs, path: projectPath })

const repo = await openRepository(repoRoot || process.cwd(), {
const repo = await openRepository(repoRoot || "file://" + process.cwd(), {
nodeishFs: fs,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const initCommand = new Command()
// We are risking that there is no git repo. As long as we only use FS features and no Git features
// from the SDK we should be fine.
// Basic operations like `loadProject` should always work without a repo since it's used in CI.
const repo = await openRepository(repoRoot ?? process.cwd(), {
const repo = await openRepository(repoRoot ?? "file://" + process.cwd(), {
nodeishFs: nodeFsPromises,
})

Expand Down

0 comments on commit 2b265b2

Please sign in to comment.