Skip to content

Instantly share code, notes, and snippets.

@bamboospirit
bamboospirit / thr-update.lisp
Last active January 1, 2021 14:32
weblocks update widget from a new thread issue
#|
UPDATE: use a websocket https://github.com/40ants/weblocks-websocket
because the response to the request was already sent so the thread has no way to communicate an update to the browser:
https://github.com/40ants/weblocks/issues/54
How to make the button "Add random task (with (update) called from a different thread)" work? Pressing on it results in this error:
Session was not created for this request!
[Condition of type SIMPLE-ERROR]
|#
(ql:quickload '(:weblocks :weblocks-ui :find-port))
@bamboospirit
bamboospirit / weblocks snippets.txt
Last active December 31, 2020 12:35
weblocks parallel rendering issue
(ql:quickload '(:weblocks :weblocks-ui :find-port))
#|
how to reproduce the bug/issue:
Click on the "render many" button and wait for it to finish rendering.
Then click again on "render many" and without any delay click on "render few"
You will see that AFTER "render few" (the last action from the UI) has finished doing its work, 
the results will be replaced by an older action from the UI ... 
How to avoid this? In a filtering widget for example, typing a word fastly will result in the wrong filtration of a long list. 
(after if finishes rendering the newest results according to the last input word, it will then render the previous results from the previous UI action when
the word was only partially typed into the box)
@bamboospirit
bamboospirit / weblocks toast.lisp
Last active December 31, 2020 13:14
weblocks simple toast effect (common lisp web framework ui frontend)
;;; load the code below then open 127.0.0.1:4002 in the browser and Click on "Click me", the toast should show up.
(ql:quickload '(:weblocks :weblocks-lass :weblocks-navigation-widget :weblocks-ui :find-port))
(defpackage app-package
(:use #:cl
#:weblocks-ui/form
#:weblocks/html)
(:import-from #:parenscript #:ps #:chain)
(:import-from #:weblocks-navigation-widget #:defroutes)
(:import-from #:weblocks/routes #:reset-routes)