3
0
mirror of https://github.com/britzl/monarch.git synced 2025-09-27 18:12:22 +02:00

Make sure to also reload pre-loaded screens if required

Fixes #39
This commit is contained in:
Björn Ritzl
2019-03-05 00:21:23 +01:00
parent 38f95e0b5b
commit 7e2ff2990c
6 changed files with 267 additions and 4 deletions

View File

@@ -243,11 +243,11 @@ local function change_context(screen)
screen.wait_for = nil
end
local function unload(screen)
local function unload(screen, force)
log("unload()", screen.id)
if screen.proxy then
if screen.auto_preload then
if screen.auto_preload and not force then
msg.post(screen.proxy, DISABLE)
screen.loaded = false
screen.preloaded = true
@@ -264,7 +264,7 @@ local function unload(screen)
go.delete(instance)
end
screen.factory_ids = nil
if screen.auto_preload then
if screen.auto_preload and not force then
screen.loaded = false
screen.preloaded = true
else
@@ -449,7 +449,7 @@ local function show_in(screen, previous_screen, reload, add_to_stack, cb)
change_context(screen)
if reload and screen.loaded then
log("show_in() reloading", screen.id)
unload(screen)
unload(screen, reload)
end
load(screen)
if add_to_stack then