Update storage version to 11 and add alert during upgrade

This commit is contained in:
2024-05-14 18:56:40 +08:00
parent 117fce390c
commit 2386e6f2e9
2 changed files with 9 additions and 3 deletions

View File

@@ -198,7 +198,7 @@ export function App() {
localStorage.setItem(STORAGE_NAME_SELECTED, `${selectedChatIndex}`);
}, [selectedChatIndex]);
const db = openDB<ChatStore>(STORAGE_NAME, 10, {
const db = openDB<ChatStore>(STORAGE_NAME, 11, {
async upgrade(db, oldVersion, newVersion, transaction) {
if (oldVersion < 1) {
const store = db.createObjectStore(STORAGE_NAME, {
@@ -226,7 +226,8 @@ export function App() {
}
}
if (oldVersion < 10) {
if (oldVersion < 11) {
alert("Start upgrading storage, just a sec... (Click OK to continue)");
if (
transaction
.objectStore(STORAGE_NAME)

View File

@@ -33,7 +33,12 @@ export default function Search(props: {
>
<div className="flex justify-between">
<span className="m-1 p-1 font-bold">Search</span>
<button className="m-1 p-1 bg-cyan-400 rounded">Close</button>
<button
className="m-1 p-1 bg-cyan-400 rounded"
onClick={() => props.setShow(false)}
>
Close
</button>
</div>
<hr />
<div>