Comments (6)
The solution I designed for REPL is that ui/window
can not only accept component, but also a reference (e.g. a var) or an atom. I also just pushed commit 9a1f239 that even set ups watcher for you on var/atom. So just reset!/def and window should refresh! Let me know if that works
from humbleui.
Ok, so I looked over the code and I've added a ^{:clojure.tools.namespace.repl/load false}
into the core function, which should hopefully allow a full reload to occur while still having everything update.
We'll see how it works.
I've been using force-reload
as defined:
(ns user
(:require [clojure.tools.namespace.repl :as ns]
[io.github.humbleui.app :as app]
[io.github.humbleui.window :as window]
[example.state :as state]
[example.core :refer [make-window]]))
(ns/set-refresh-dirs "src" "dev")
(defn reload [{:keys [hard-refresh? reflection? math?]
:or {hard-refresh? false reflection? true math? :warn-on-boxed}}]
(set! *warn-on-reflection* reflection?)
(set! *unchecked-math* math?)
(let [ns-refresh-fn
(if hard-refresh?
(requiring-resolve 'clojure.tools.namespace.repl/refresh-all)
(requiring-resolve 'clojure.tools.namespace.repl/refresh))
res (ns-refresh-fn)]
(if (instance? Throwable res)
(throw res)
res)))
(defn force-reload
([] (force-reload {:hard-refresh? false
:math? nil}))
([opts]
(do
(when @state/*window
(window/close @state/*window))
(reload opts)
(app/doui
(make-window)))))
(comment
(force-reload))
As re-defining a low level form doesn't always work as that doesn't change anything unless you propagate that change up the entire app tree.
----- EDIT -----
Ok, it's not quite fixed on macos, there's a new issue:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fff32d4887d, pid=64764, tid=152339
#
# JRE version: OpenJDK Runtime Environment Homebrew (19.0.1) (build 19.0.1)
# Java VM: OpenJDK 64-Bit Server VM Homebrew (19.0.1, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-amd64)
# Problematic frame:
# C [CoreVideo+0x187d] CVHWTime::reset()+0xd
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/folcon/Code/pankration/hs_err_pid64764.log
#
# If you would like to submit a bug report, please visit:
# https://github.com/Homebrew/homebrew-core/issues
#
/bin/sh: line 1: 64764 Abort trap: 6 lein with-profile +dev trampoline run
make: *** [dev] Error 134
I've got an error report this time, would it be useful for you to see?
from humbleui.
Ok, noticed new behavior on windows as well, using same functionality as defined above, it spawns a new window, the old window goes black and then the entire application exits with:
Process finished with exit code 0
So there's no exception or anything.
Is this due to a gap / difference in the current JWM api's between macos / windows?
from humbleui.
I’m not sure. The way I had it setup is that I don’t re-create window on reload, only a var that represents “application” or “ui” in that window. So window stays the same, but it starts rendering new UI
from humbleui.
Hmm, from what I could tell I was doing a similar thing, ok, I'll try and investigate this over the weekend!
EDIT:
So I finally had a chance to properly chase this up and it's looking fixed?
I'm going to keep an eye on it for a bit longer, but if it doesn't reappear in a few weeks of fiddling, then I'll close this and try and document what the workflow looks like as well somewhere =)...
EDIT:
Spoke too soon, in some cases the UI just does not update, I've not figured out why, but when I get in this state, I can change something simple like a label and it just doesn't change.
So something is happening, interestingly the refresh
doesn't detect a change, but neither refresh
nor refresh-all
in clojure.tools.namespace.repl
fix it.
This is why I changed to reseting the window I think.
from humbleui.
Just adding my experience here in case it's useful - I tried setting :exit-on-close? false
which worked to prevent the REPL from shutting down when I closed the window via my window manager, but the next time I called ui/start-app!
(eval'ing -main
) I got this SIGSEGV:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000728cc5c6f65d, pid=3538188, tid=3538403
#
# JRE version: OpenJDK Runtime Environment (22.0+36) (build 22+36)
# Java VM: OpenJDK 64-Bit Server VM (22+36, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C [libjwm_x64.so+0x1f65d] Java_io_github_humbleui_jwm_impl_RefCounted_getRefCount+0xd
from humbleui.
Related Issues (20)
- BUG (Mac): Enabling "on top" in examples app hides window in Mission Control HOT 1
- Nested ui/draggable break themselves HOT 1
- nrepl init fails on Windows 10 HOT 3
- `[first experience]` Exception in `start-app!` HOT 6
- UnsatisfiedLinkError: Library file skija.dll not found in windows if version difference HOT 4
- Using `with-open` blows up HOT 3
- Event handlers for inputs and other widgets HOT 1
- Improve component exceptions HOT 1
- Cannot run repl, missing dependency HOT 1
- Nested draggables both get dragged when below pointer
- Scrollbar shouldn’t go below minimal size when too many elements
- Button inside nested with-bounds not firing HOT 4
- Incorrect mouse cursor when hovering over text field
- Move by word boundaries in text input with pressed Control
- Pressing Ctrl + z in the text field will result in a crash HOT 5
- Crash when pressing Ctrl+Z inside a text-field HOT 4
- Tweaks to compile with GraalVM HOT 7
- UnsatisfiedLinkError on master branch HOT 4
- Scaling on HIDPI screen HOT 11
- IME support on Wayland HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from humbleui.