I'm trying to track down a potential bug in the latest weblocks-dev. I
have a navigation widget with three menu items, "Home", "Menu Item 1"
and "Menu Item 2". Clicking on "Menu Item 2" creates a widget with one
child widget. The child widget's RENDER-WIDGET-BODY method has a
WITH-FLOW form. I have pasted the source of this app below.
If I start on the home page with a new session, clicking on "Menu Item
2" does not start the flow. However, if in the same session, clicking
on "Home" then back to "Menu Item 2" does start the flow as I would
expect. Also, if you're on the "Menu Item 2" page and have debug mode
enabled, resetting your session will also display FLOW-WIDGET as
expected.
Perhaps it is not a bug and I'm simply misusing WITH-FLOW. Regardless,
the behavior does seem inconsistent.
I'm still fairly new to the weblocks source code, but what better way
to learn about it than debugging. Here's what I noticed so far, some
which may not be relevant:
- Widget TWO's children is set to FLOW-WIDGET when FLOW-WIDGET
renders, or to CHILD-OF-TWO when the flow does not render. Therefore
it appears the widget's children are not set or updated correctly.
- All requests using the navigation widget are normal requests rather
than ajax requests, as expected.
- When FLOW-WIDGET renders, the RENDER-WIDGET-BODY method of
CHILD-OF-TWO does not get called. Next I will look at
UPDATE-WIDGET-TREE and see how FLOW-WIDGET replaces the child
widget.
I will be leaving shortly for a couple of days. When I return I will
try to investigate further. In the meantime thanks for any help!
Example source code of an app to reproduce the problem:
(defun init-user-session (root)
(setf (widget-children root)
(list (make-navigation 'nav
"Home" 'make-home-page
"Menu Item 1" (make-menu-item-1)
"Menu Item 2" (make-menu-item-2)))))
(defun make-home-page ()
(with-html (:p "Home Page")))
(defun make-menu-item-1 ()
(make-instance 'one))
(defun make-menu-item-2 ()
(make-instance 'two
:children (make-instance 'child-of-two)))
(defwidget one ()
())
(defmethod render-widget-body ((obj one) &rest args
&key &allow-other-keys)
(with-html (:p "One")))
(defwidget two ()
())
(defmethod render-widget-body ((obj two) &rest args
&key &allow-other-keys)
(with-html (:p "Two")))
(defwidget child-of-two ()
())
(defmethod render-widget-body ((obj child-of-two) &rest args
&key &allow-other-keys)
(break)
(with-flow obj
(yield (make-instance 'flow-widget)))
(with-html (:p "child of two")))
(defwidget flow-widget ()
())
(defmethod render-widget-body ((obj flow-widget) &rest args
&key &allow-other-keys)
(with-html (:p "Flow Widget "
(render-link (lambda (&rest args)
(answer obj))
"Continue"))))
--
You received this message because you are subscribed to the Google Groups
"weblocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/weblocks?hl=en.