[docs] Fix missing Persistence page (#2828)
Fixes #2826, extracted from #2680 The problem is that we had two different articles whose ids were being derived as `persistence`, the `persistence.mdx` file and the `persistence/` example. I've 1. Made it an error for two articles to have the same id 2. Renamed the `persistence/` article to `local-storage` since that's the API it's using. ### Change Type - [ ] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [x] `documentation` — Changes to the documentation only[^2] - [ ] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Test Plan 1. Add a step-by-step description of how to test your PR here. 3. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Add a brief release note for your PR here.
This commit is contained in:
parent
ad5a61879a
commit
9d895aab13
5 changed files with 35 additions and 28 deletions
|
@ -8,19 +8,19 @@ export async function addContentToDb(
|
|||
content: GeneratedContent
|
||||
) {
|
||||
const sectionInsert = await db.prepare(
|
||||
`REPLACE INTO sections (id, idx, title, description, path, sidebar_behavior) VALUES (?, ?, ?, ?, ?, ?)`
|
||||
`INSERT INTO sections (id, idx, title, description, path, sidebar_behavior) VALUES (?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
|
||||
const categoryInsert = await db.prepare(
|
||||
`REPLACE INTO categories (id, title, description, sectionId, sectionIndex, path) VALUES (?, ?, ?, ?, ?, ?)`
|
||||
`INSERT INTO categories (id, title, description, sectionId, sectionIndex, path) VALUES (?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
|
||||
const headingsInsert = await db.prepare(
|
||||
`REPLACE INTO headings (idx, articleId, level, title, slug, isCode, path) VALUES (?, ?, ?, ?, ?, ?, ?)`
|
||||
`INSERT INTO headings (idx, articleId, level, title, slug, isCode, path) VALUES (?, ?, ?, ?, ?, ?, ?)`
|
||||
)
|
||||
|
||||
const articleInsert = await db.prepare(
|
||||
`REPLACE INTO articles (
|
||||
`INSERT INTO articles (
|
||||
id,
|
||||
groupIndex,
|
||||
categoryIndex,
|
||||
|
@ -79,6 +79,7 @@ export async function addContentToDb(
|
|||
throw Error(`hey, article ${article.id} has no id`)
|
||||
}
|
||||
|
||||
try {
|
||||
await articleInsert.run(
|
||||
article.id,
|
||||
article.groupIndex,
|
||||
|
@ -100,6 +101,10 @@ export async function addContentToDb(
|
|||
article.content,
|
||||
article.path
|
||||
)
|
||||
} catch (e: any) {
|
||||
console.error(`ERROR: Could not add article with id '${article.id}'`)
|
||||
throw e
|
||||
}
|
||||
|
||||
await db.run(`DELETE FROM headings WHERE articleId = ?`, article.id)
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import { refreshContent } from './scripts/functions/refreshContent'
|
|||
import { debounce } from './utils/debounce'
|
||||
import { nicelog } from './utils/nicelog'
|
||||
|
||||
refreshContent({ silent: true })
|
||||
|
||||
fs.watch(
|
||||
'content',
|
||||
{ persistent: true, recursive: true },
|
||||
|
|
|
@ -67,7 +67,7 @@ test.describe('Routes', () => {
|
|||
})
|
||||
|
||||
test('persistence', async ({ page }) => {
|
||||
await page.goto('http://localhost:5420/persistence/full')
|
||||
await page.goto('http://localhost:5420/local-storage/full')
|
||||
await page.waitForSelector('.tl-canvas')
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Persistence
|
||||
component: ./PersistenceExample.tsx
|
||||
title: Local Storage
|
||||
component: ./LocalStorageExample.tsx
|
||||
category: data/assets
|
||||
---
|
||||
|
Loading…
Reference in a new issue