Bug when updating menu during development

23 views
Skip to first unread message

Naftoli Gugenheim

unread,
Aug 24, 2011, 12:58:00 AM8/24/11
to liftweb
I've noticed a few times, when developing with JRebel and a change is made to the SiteMap, when the page is reloaded it comes up wrong.
For instance, I had the following menu structure:

Clients -> /clients/list
  edit -> /clients/edit
  ...
Equipment -> /equipment/list

I added a new submenu to clients, "Merge Duplicates." When I load the page, I see "Merge Duplicates" where "Equipment" used to be, and it links to /equipment/list. There is no "Equipment" in the menu.

Thanks.

Andreas Joseph Krogh

unread,
Aug 24, 2011, 2:00:55 AM8/24/11
to lif...@googlegroups.com
FWIW I've seen irregularities in the menu generated by the site-map too, but only in DEV-mode. We experienced that the menu-structure got mixed-up. The problems went away running in -Drun.mode=production and is not easily reproducible.

--
Andreas Joseph Krogh <and...@officenet.no>
Senior Software Developer / CTO
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Rosenholmveien 25       | know how to do a thing and to watch         |
1414 Trollåsen          | somebody else doing it wrong, without       |
NORWAY                  | comment.                                    |
Org.nr: NO 981 479 076  |                                             |
                        |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+


Naftoli Gugenheim

unread,
Aug 24, 2011, 2:33:25 AM8/24/11
to lif...@googlegroups.com
Right, it's probably a bug in the feature that allows the site map to be reloaded in development mode.


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Jeppe Nejsum Madsen

unread,
Aug 24, 2011, 6:00:58 AM8/24/11
to lif...@googlegroups.com
Naftoli Gugenheim <nafto...@gmail.com> writes:

> Right, it's probably a bug in the feature that allows the site map to be
> reloaded in development mode.

Fwiw, I've never seen this. Take care not to mutate any state in the
functions that calculate the sitemap as these functions (when running in
dev mode) will be called on every request iirc.

/Jeppe

David Pollak

unread,
Aug 24, 2011, 6:45:42 AM8/24/11
to lif...@googlegroups.com

I have no clue why this is happening.  Is there a set of cases where it happens more often?  Can you print the SiteMap instance each time it's calculated to see if it's a calculation issue or it's a "how Lift interprets the valid data you've supplied" issue?
 

Thanks.

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



--
Lift, the simply functional web framework http://liftweb.net

Naftoli Gugenheim

unread,
Aug 24, 2011, 3:37:03 PM8/24/11
to lif...@googlegroups.com

I have no clue why this is happening.  Is there a set of cases where it happens more often?  Can you print the SiteMap instance each time it's calculated to see if it's a calculation issue or it's a "how Lift interprets the valid data you've supplied" issue?
 

Thanks.


How do I do that?

Naftoli Gugenheim

unread,
Aug 24, 2011, 3:37:50 PM8/24/11
to lif...@googlegroups.com
I'm 99.9% sure there's no mutability going on. :)


Naftoli Gugenheim

unread,
Aug 24, 2011, 3:43:42 PM8/24/11
to lif...@googlegroups.com
I don't think it's limited to any special case. Unless I'm wrong it should be super-easy to reproduce:
1. Take any application with a hierarchical menu, preferably at least three levels (e.g. home > category > task).
2. Comment out a menu entry for a (sub)submenu whose parent has a sibling menu after it.
3. sbt jetty-run ~prepare-webapp (with JRebel enabled)
4. Load the commented-out menu's parent's page so you can see its children.
5. Uncomment the menu entry, save, wait for prepare-webapp to finish running.
6. Reload the page.

Andreas Joseph Krogh

unread,
Aug 24, 2011, 4:44:44 PM8/24/11
to lif...@googlegroups.com
On 08/24/2011 09:43 PM, Naftoli Gugenheim wrote:
> I don't think it's limited to any special case. Unless I'm wrong it
> should be super-easy to reproduce:
> 1. Take any application with a hierarchical menu, preferably at least
> three levels (e.g. home > category > task).
> 2. Comment out a menu entry for a (sub)submenu whose parent has a
> sibling menu after it.
> 3. sbt jetty-run ~prepare-webapp (with JRebel enabled)
> 4. Load the commented-out menu's parent's page so you can see its
> children.
> 5. Uncomment the menu entry, save, wait for prepare-webapp to finish
> running.
> 6. Reload the page.

FWIW I experienced this menu-strangeness without JRebel, but only in
dev-mode. Reloading the page was enough to trigger the issue, but it
happened rarely.

--
Andreas Joseph Krogh <and...@officenet.no>
Senior Software Developer / CTO
Public key: http://home.officenet.no/~andreak/public_key.asc
------------------------+---------------------------------------------+
OfficeNet AS | The most difficult thing in the world is to |
Rosenholmveien 25 | know how to do a thing and to watch |

1414 Troll�sen | somebody else doing it wrong, without |

Naftoli Gugenheim

unread,
Aug 24, 2011, 5:02:32 PM8/24/11
to lif...@googlegroups.com
How did the change get picked up without reloading the webapp then?


On Wed, Aug 24, 2011 at 4:44 PM, Andreas Joseph Krogh <andrea...@gmail.com> wrote:
On 08/24/2011 09:43 PM, Naftoli Gugenheim wrote:
> I don't think it's limited to any special case. Unless I'm wrong it
> should be super-easy to reproduce:
> 1. Take any application with a hierarchical menu, preferably at least
> three levels (e.g. home > category > task).
> 2. Comment out a menu entry for a (sub)submenu whose parent has a
> sibling menu after it.
> 3. sbt jetty-run ~prepare-webapp (with JRebel enabled)
> 4. Load the commented-out menu's parent's page so you can see its
> children.
> 5. Uncomment the menu entry, save, wait for prepare-webapp to finish
> running.
> 6. Reload the page.

FWIW I experienced this menu-strangeness without JRebel, but only in
dev-mode. Reloading the page was enough to trigger the issue, but it
happened rarely.

--
Andreas Joseph Krogh <and...@officenet.no>
Senior Software Developer / CTO
Public key: http://home.officenet.no/~andreak/public_key.asc
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Rosenholmveien 25       | know how to do a thing and to watch         |
1414 Trollåsen          | somebody else doing it wrong, without       |

NORWAY                  | comment.                                    |
Org.nr: NO 981 479 076  |                                             |
                       |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909 56 963 |                                             |
------------------------+---------------------------------------------+

--

Andreas Joseph Krogh

unread,
Aug 24, 2011, 5:10:43 PM8/24/11
to lif...@googlegroups.com
On 08/24/2011 11:02 PM, Naftoli Gugenheim wrote:
> How did the change get picked up without reloading the webapp then?

That's the issue, I didn't change anything but still the menu got
inconsistent. If i remember correctly the issue was that the generated
link of an item was (sometimes) mixed-up, but the menu-items was in
correct order/structure.

I'll see if I can reproduce and give more feedback, but it'll have to
wait until tomorrow.

--
Andreas Joseph Krogh <and...@officenet.no>
Senior Software Developer / CTO
Public key: http://home.officenet.no/~andreak/public_key.asc
------------------------+---------------------------------------------+
OfficeNet AS | The most difficult thing in the world is to |
Rosenholmveien 25 | know how to do a thing and to watch |

1414 Troll�sen | somebody else doing it wrong, without |

David Pollak

unread,
Aug 26, 2011, 7:30:12 PM8/26/11
to lif...@googlegroups.com

    // set the sitemap.  Note if you don't want access control for
    // each page, just comment this line out.
    LiftRules.setSiteMapFunc(() => {
     val res = sitemapMutators(sitemap)
     println(res)
     res
})

If the SiteMap is stable between requests but being displayed differently, then there's something wonky someplace.  If the method that's calculating the SiteMap is calculating it differently each time, then it's not a Lift issue (but we know where to look to track it down).
 

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Naftoli Gugenheim

unread,
Aug 28, 2011, 6:10:41 PM8/28/11
to lif...@googlegroups.com
I guess I should have mentioned -- I'm not using setSitemMapFunc, but setSiteMap. 

David Pollak

unread,
Aug 30, 2011, 7:16:36 PM8/30/11
to lif...@googlegroups.com
On Sun, Aug 28, 2011 at 3:10 PM, Naftoli Gugenheim <nafto...@gmail.com> wrote:
I guess I should have mentioned -- I'm not using setSitemMapFunc, but setSiteMap. 

If you're using setSiteMap, I'm not sure how you could even get dynamic menus.  Please change to setSiteMapFunc and see if that addresses the issue.
 
Reply all
Reply to author
Forward
0 new messages