kaspermarkus/universal — pull request #10 by radmanovi4 (2014-12-15 17:14:30+00:00)
Title: NOJRA: Example payloads that make PCP rerender

Here's a small example scenario. You can check how this behaves with the other pull request - https://github.com/kaspermarkus/prefsEditors/pull/1

Here are some answers to your questions:
1) What happens if no settings are sent to the PCP when it starts up?

It just opens with no adjusters, only "full editor" and "log out" buttons on top + the frame. Here's an example payload with only a message:

`{
settings: {},
messages: [{
type: "infoMessage",
message: {
en: "Some message"
}
}]
}`

2) is it a problem if no user is logged in when the PCP is started?

No, it's a problem for applying settings - here upon handling the /update message the withSession call requires a logged user https://github.com/kaspermarkus/universal/blob/GPII-752/gpii/node_modules/flowManager/src/UserUpdate.js#L44

3) Should I do anything in particular to update the shown settings in the PCP, or is it as simple as passing a new block of settings

As simple as passing a new block of settings. :)

4) if a user logs out, is it possible to send a signal to the PCP 'clearing it'? (e.g. an empty settings block)?

The fastest way you can clear the PCP is to call these three lines https://github.com/radmanovi4/prefsEditors/blob/GPII-752/demos/prefsEditor/pcp.html#L127-L129 with empty settings block. There could be added another check there for "clearing message" and just execute these lines.

5) I currently have no effect when modifying a setting in the PCP - but it might either be due to me starting it without a user being logged in, or something else.. looking into this now

Yes, without a user being logged, nothing will be applied. Updating returns "{"name":"error","args":[{"isError":true,"message":"Error handling request which required active session, but none was active"}]}" in the console.

6) just for later debugging purposes - where is the /update call made from the PCP code?

This is the invoker for the /update call: https://github.com/radmanovi4/prefsEditors/blob/GPII-752/src/pcp/js/socket.js#L38-L42