internal: incomplete vault systems behind feature flag (#2340)

This commit is contained in:
Mo
2023-06-30 09:01:56 -05:00
committed by GitHub
parent d16e401bb9
commit b032eb9c9b
638 changed files with 20321 additions and 4813 deletions

View File

@@ -34,7 +34,7 @@ const PackageEntry: FunctionComponent<PackageEntryProps> = ({ application, exten
const toggleOfflineOnly = () => {
const newOfflineOnly = !offlineOnly
setOfflineOnly(newOfflineOnly)
application.mutator
application
.changeAndSaveItem<ComponentMutator>(extension, (mutator) => {
mutator.offlineOnly = newOfflineOnly
})
@@ -49,7 +49,7 @@ const PackageEntry: FunctionComponent<PackageEntryProps> = ({ application, exten
const changeExtensionName = (newName: string) => {
setExtensionName(newName)
application.mutator
application
.changeAndSaveItem<ComponentMutator>(extension, (mutator) => {
mutator.name = newName
})

View File

@@ -53,6 +53,7 @@ const PackagesPreferencesSection: FunctionComponent<Props> = ({
.then(async (shouldRemove: boolean) => {
if (shouldRemove) {
await application.mutator.deleteItem(extension)
void application.sync.sync()
setExtensions(loadExtensions(application))
}
})

View File

@@ -12,7 +12,9 @@ type Props = {
export const ShouldPersistNoteStateKey = 'ShouldPersistNoteState'
const Persistence = ({ application }: Props) => {
const [shouldPersistNoteState, setShouldPersistNoteState] = useState(application.getValue(ShouldPersistNoteStateKey))
const [shouldPersistNoteState, setShouldPersistNoteState] = useState(
application.getValue<boolean>(ShouldPersistNoteStateKey),
)
const toggleStatePersistence = (shouldPersist: boolean) => {
application.setValue(ShouldPersistNoteStateKey, shouldPersist)

View File

@@ -88,7 +88,7 @@ export class EditSmartViewModalController {
this.setIsSaving(true)
await this.application.mutator.changeAndSaveItem<SmartViewMutator>(this.view, (mutator) => {
await this.application.changeAndSaveItem<SmartViewMutator>(this.view, (mutator) => {
mutator.title = this.title
mutator.iconString = (this.icon as string) || SmartViewDefaultIconName
mutator.predicate = JSON.parse(this.predicateJson) as PredicateJsonForm
@@ -111,7 +111,10 @@ export class EditSmartViewModalController {
confirmButtonStyle: 'danger',
})
if (shouldDelete) {
this.application.mutator.deleteItem(view).catch(console.error)
this.application.mutator
.deleteItem(view)
.then(() => this.application.sync.sync())
.catch(console.error)
}
}

View File

@@ -47,10 +47,13 @@ const SmartViews = ({ application, featuresController }: Props) => {
confirmButtonStyle: 'danger',
})
if (shouldDelete) {
application.mutator.deleteItem(view).catch(console.error)
application.mutator
.deleteItem(view)
.then(() => application.sync.sync())
.catch(console.error)
}
},
[application.mutator],
[application.mutator, application.sync],
)
return (