#143 : Panels now edit after using dropdown
From now on, all panels will update/edit themselfs after a dropdown has been used. This will reset the dropdown selection in the user client which results in a smoother user experience.
This commit is contained in:
@@ -52,6 +52,7 @@ export class ODDatabaseManager_Default extends ODDatabaseManager {
|
||||
* It's used to generate typescript declarations for this class.
|
||||
*/
|
||||
export interface ODFormattedJsonDatabaseIds_DefaultGlobal {
|
||||
"opendiscord:panel-message":string,
|
||||
"opendiscord:panel-update":string,
|
||||
"opendiscord:option-suffix-counter":number,
|
||||
"opendiscord:option-suffix-history":string[],
|
||||
|
||||
@@ -5,7 +5,10 @@ export const loadVersionMigrationSystem = async () => {
|
||||
await preloadMigrationContext()
|
||||
|
||||
const lastVersion = await isMigrationRequired()
|
||||
|
||||
//save last version to database (OR set to current version if no migration is required)
|
||||
opendiscord.versions.add(lastVersion ? lastVersion : api.ODVersion.fromString("opendiscord:last-version",opendiscord.versions.get("opendiscord:version").toString()))
|
||||
|
||||
if (lastVersion && !opendiscord.flags.get("opendiscord:no-migration").value){
|
||||
//MIGRATION IS REQUIRED
|
||||
opendiscord.log("Detected old data!","info")
|
||||
|
||||
@@ -2,15 +2,16 @@ import {opendiscord, api, utilities} from "../../index"
|
||||
|
||||
export const migrations = [
|
||||
//MIGRATE TO v4.0.0
|
||||
new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.0"),async () => {
|
||||
//MIGRATE BEFORE STARTUP
|
||||
new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.0"),async () => {},async () => {}),
|
||||
|
||||
//MIGRATE TO v4.0.1
|
||||
new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.1"),async () => {},async () => {
|
||||
//AFTER INIT MIGRATION
|
||||
|
||||
//nothing needs to be transferred :)
|
||||
},() => {
|
||||
//MIGRATE AFTER INITIAL STARTUP (plugins, flags, config, database, language, ... => loaded)
|
||||
|
||||
//nothing needs to be transferred :)
|
||||
}),
|
||||
//MIGRATE TO v4.0.1 (nothing)
|
||||
new utilities.ODVersionMigration(api.ODVersion.fromString("opendiscord:version","v4.0.0"),async () => {},() => {})
|
||||
//add opendiscord:panel-message properties for all existing panels.
|
||||
const globalDatabase = opendiscord.databases.get("opendiscord:global")
|
||||
for (const panel of (await globalDatabase.getCategory("opendiscord:panel-update") ?? [])){
|
||||
globalDatabase.set("opendiscord:panel-message",panel.key,panel.value)
|
||||
}
|
||||
})
|
||||
]
|
||||
Reference in New Issue
Block a user