The attached patch uses the deep copy version of $.extend. If your module adds JS values to the Drupal.settings.myModuleValues by using deep copy $.extend we make sure that an AJAX response that adds a new value to those settings is actually merged into the object instead of replacing it completely.
Ajax Load module suffered from the same issue: #943132: Scripts Settings need to be deep copied.

Files: 
CommentFileSizeAuthor
#14 ctools_ajax_render_3-999164.patch2.18 KBmrjeeves
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#6 ctools_ajax_render_2.patch2.08 KBmrjeeves
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#5 ctools_ajax_render.patch2.09 KBmrjeeves
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#4 ctools_deepcopy_2.patch1.12 KBmrjeeves
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
ctools_deepcopy_1.patch411 bytesandreiashu
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch ctools_deepcopy_1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

+1 I just ran into a bug were settings were disappearing.

Also worth pointing out that this is what D7's setting command does:

  /**
   * Command to set the settings that will be used for other commands in this response.
   */
  settings: function (ajax, response, status) {
    if (response.merge) {
      $.extend(true, Drupal.settings, response.settings);
    }
    else {
      ajax.settings = response.settings;
    }
  },

Version:6.x-1.8» 6.x-1.x-dev

Hopefully we can push this into the next version of ctools?

StatusFileSize
new1.12 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

i've reviewed the patch above and added an update to the preprocess function on the server-side to the same effect. this issue is blocking the dependency of ctools for the 2.x branch of ajax_load. this is against the latest dev

StatusFileSize
new2.09 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

ooook, after working on this issue more, and looking over the d7 stuff again, the merge flag is really handy, this patch includes a merge arg and also implements a $return arg for the ctools_ajax_render function because I prefer the argument order and I need it as well, If you would like the $return arg patch separate, just let me know.

StatusFileSize
new2.08 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

and once more changing the 'else if' to 'elseif'....

+1 this just killed me on a custom module. Any chance we can get his committed?

Status:Needs review» Reviewed & tested by the community

We can set this as rtbc. @mrjeeves patch in #6 looks robust and extends the API while keeping the existing defaults.

Thank you. I've been waiting a good minute for this to be rtbc, I'd really like to see this change made as it would allow me to work further on the "live" updates system I've imagined possible for some time.

I ended up just overriding the js function with my own with the same name. I'm not particularly sure if this is 100% safe to do or best practices (I would love to hear about it if it isn't) but since ctools ajax ended up in core in D7 I think most of the changes to D6 version are bug fixes rather than feature requests. I just wanted to throw the idea out there because it works quite well for me and doesn't require hacking ctools or waiting for this to be committed.

This issue has be open for ages, the patch is small and robust, what do we have to do to get some attention on this matter???

Not sure why, but #6 was causing issues for me when using jCarousel in a modal. Specifically, this line in ajax-responder.js:

$.extend(data.merge, Drupal.settings, data.argument);

It was causing my jCarousel javascript to not be executed. I tried it with the original patch in the issue, and I do not have a problem if it looks like this:
$.extend(true, Drupal.settings, data.argument);

I'm short on time at the moment so I'm just reporting it. No suggested fix for now but I'm happy to provide extra information if needed.

Update: It works properly for me if we do something like the D7 version, such as:
  Drupal.CTools.AJAX.commands.settings = function(data) {
    if (data.merge) {
       $.extend(true, Drupal.settings, data.argument);
    }
    else {
      $.extend(Drupal.settings, data.argument);
    }
  };

Status:Reviewed & tested by the community» Needs review
StatusFileSize
new2.18 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

reroll with additions from #13

I'm just in the process of testing #14. I appreciate that from a backward-compatibility perspective adding a parameter to ctools_ajax_render is the safe choice, but is there any case where doing a deep merge is going to break functionality? As far as I can see, there's very little risk aside from a slight performance hit client-side?