A big gotcha - perserveState

30 views
Skip to first unread message

Ryan Stille

unread,
Sep 20, 2013, 8:47:01 AM9/20/13
to model...@googlegroups.com
I ran into a big issue recently. I've come to realize that preserveState is on by default. That means as our sales staff uses our intranet, using many tabs at once, their data from one form post is getting blasted into another. This leads to things like shipping an order to the wrong customer!

I have hundreds of events across many ModelGlue.xml files. So rather than add preserveState=false to every one, I'd like to change the default. I'm looking for good ways to do this. I could just modify gesture/eventhandler/Result.cfc, but I'd rather not change the core MG files of course. I am wondering if there is a way at application startup time that I could replace the instantiated Result component with one of my own?

I'll be upgrading to MG 3.1 as part of this change, since our current version only recognizes the preserveState attribute when the result is a named result. I tried 3.2 but was getting all kinds of errors.

Thanks,
Ryan

Dan Wilson

unread,
Sep 20, 2013, 9:01:19 AM9/20/13
to model...@googlegroups.com
I'm not clear from your email, which version of Model Glue you are using.

Did you report the errors you got on 3.2?


DW

Friday, September 20, 2013 8:47 AM
--
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
 
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to model...@googlegroups.com
To unsubscribe from this group, send email to
model-glue+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
---
You received this message because you are subscribed to the Google Groups "model-glue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to model-glue+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ryan Stille

unread,
Sep 20, 2013, 9:27:02 AM9/20/13
to model...@googlegroups.com
2.0 Public Beta 1

But as of yesterday morning my local dev is running on 3.1. Nothing is different (as far as this problem) on 3.1 except that perserveState=false works on unnamed results. I will be moving production to 3.1.

The errors I recall getting on 3.2 were mostly about events not existing. I think it might have something to do with the new lazy recompiling feature.

Ryan Stille

unread,
Sep 20, 2013, 11:12:36 AM9/20/13
to model...@googlegroups.com
After digging through the MG code, I don't think there is a way to default preserveState to false without changing the core files.

I think a nice enhancement would be the ability to change the default by configuration. We've been using MG for years on several sites and I can't think of once when we've needed preserveState=true. We always use redirect=true append=recordID to let the use see their modified record. And with multiple tab usage being so common now days, I doubt I'm the only person that has experienced this issue. I may be the only person who *knows* they've experienced this issue :-). This could silently corrupt data without anyone realizing it. By chance someone here happened to notice that a customer had the address of another customer, and that's where my troubleshooting started.

Dan Wilson

unread,
Sep 20, 2013, 12:45:11 PM9/20/13
to model...@googlegroups.com
The 3 places I see preserveState being referenced in the newest MG code all show a default of false:
<cfargument name="preserveState" type="boolean" required="false" default="false" hint="Preserve state across the redirect?" />

I can't totally dive into this in detail, because NCDevCon (which I'm running) is tomorrow. But if you have some additional details you can share, I might be able to figure out something for you.

Almost all internal components are externally overridable


DW

Friday, September 20, 2013 11:12 AM
Friday, September 20, 2013 9:27 AM
2.0 Public Beta 1

But as of yesterday morning my local dev is running on 3.1. Nothing is different (as far as this problem) on 3.1 except that perserveState=false works on unnamed results. I will be moving production to 3.1.

The errors I recall getting on 3.2 were mostly about events not existing. I think it might have something to do with the new lazy recompiling feature.

On Friday, September 20, 2013 8:01:19 AM UTC-5, Dan Wilson - sipa...@gmail.com wrote:
--
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
 
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to model...@googlegroups.com
To unsubscribe from this group, send email to
model-glue+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
---
You received this message because you are subscribed to the Google Groups "model-glue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to model-glue+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Friday, September 20, 2013 9:01 AM

Ryan Stille

unread,
Sep 20, 2013, 2:18:36 PM9/20/13
to model...@googlegroups.com
Thanks for the help. Are you sure you are looking the right code? In the 3.1.2999 and 3.2 RC2 code I downloaded, ModelGlue/gesture/eventhandler/Result.cfc has preserveState defaulted to true.


Have a great conference, wish I was there.
Reply all
Reply to author
Forward
0 new messages