mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
not found should return null
This commit is contained in:
parent
f148d7fcf2
commit
f90554e87e
@ -20,7 +20,7 @@ console.log("Wave Starting");
|
|||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", async () => {
|
document.addEventListener("DOMContentLoaded", async () => {
|
||||||
console.log("DOMContentLoaded");
|
console.log("DOMContentLoaded");
|
||||||
// ensures client/window are loaded into the cache before rendering
|
// ensures client/window/workspace are loaded into the cache before rendering
|
||||||
await WOS.loadAndPinWaveObject<Client>(WOS.makeORef("client", clientId));
|
await WOS.loadAndPinWaveObject<Client>(WOS.makeORef("client", clientId));
|
||||||
const waveWindow = await WOS.loadAndPinWaveObject<WaveWindow>(WOS.makeORef("window", windowId));
|
const waveWindow = await WOS.loadAndPinWaveObject<WaveWindow>(WOS.makeORef("window", windowId));
|
||||||
await WOS.loadAndPinWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
|
await WOS.loadAndPinWaveObject<Workspace>(WOS.makeORef("workspace", waveWindow.workspaceid));
|
||||||
|
@ -156,6 +156,9 @@ func SetMeta(waveObj WaveObj, meta map[string]any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ToJsonMap(w WaveObj) (map[string]any, error) {
|
func ToJsonMap(w WaveObj) (map[string]any, error) {
|
||||||
|
if w == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
m := make(map[string]any)
|
m := make(map[string]any)
|
||||||
dconfig := &mapstructure.DecoderConfig{
|
dconfig := &mapstructure.DecoderConfig{
|
||||||
Result: &m,
|
Result: &m,
|
||||||
|
@ -103,7 +103,10 @@ func DBGetORef(ctx context.Context, oref waveobj.ORef) (waveobj.WaveObj, error)
|
|||||||
table := tableNameFromOType(oref.OType)
|
table := tableNameFromOType(oref.OType)
|
||||||
query := fmt.Sprintf("SELECT oid, version, data FROM %s WHERE oid = ?", table)
|
query := fmt.Sprintf("SELECT oid, version, data FROM %s WHERE oid = ?", table)
|
||||||
var row idDataType
|
var row idDataType
|
||||||
tx.Get(&row, query, oref.OID)
|
found := tx.Get(&row, query, oref.OID)
|
||||||
|
if !found {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
rtn, err := waveobj.FromJson(row.Data)
|
rtn, err := waveobj.FromJson(row.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return rtn, err
|
return rtn, err
|
||||||
|
Loading…
Reference in New Issue
Block a user