Updating UI-Only fields no longer working in Rockaway 8.10

  • 2
  • Problem
  • Updated 2 years ago
  • Not a Problem
I have a single page app prototype I've been working on in Banzai. It has a model called State that has no Salesforce object and several ui-only fields that I use to store the UI state at any given time. UI components such as navigation items, buttons and row actions fire actions that update the fields on State, then Javascript event handlers read that and drive the UI change.

In Banzai it has worked beautifully for months, but after a recent upgrade to Rockaway 8.10 it stopped working. After some digging, I found that Rockaway doesn't seem to allow updating ui-only fields on a model with no underlying Salesforce object. If I bind my State model to a Salesforce object, everything works again.

Any idea why that would be the case? My model really only has a client side purpose, so binding it to an object doesn't make sense.
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb

Posted 2 years ago

  • 2
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
This gets weirder. Further testing shows that I can update a ui-only field on one model that's based on a Salesforce object, but not on another model that's also based on a Salesforce object. Really hard to produce a repeatable pattern.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Can you identify any difference at all between the two models? 

Can you create a simple repro page we could put in our QA org and test? 
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,220 Points 5k badge 2x thumb
Glenn~

Thanks for notifying us of this problem. I've forwarded your post to our dev team to look into. If you could also put the XML for a simple repro page we could put in our QA org to test like Rob mentioned, that would be super helpful!

Thanks!
Karen
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
So I tried to create a simple test page that would recreate my problem. I created the example below, but annoyingly, it works just fine:
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" showheader="false" theme="Lightning Design">
    <models>
        <model id="Account" limit="1" query="false" createrowifnonefound="true" adapter="salesforce" type="" sobject="Account">
            <fields>
                <field id="Context" uionly="true" displaytype="TEXT" label="Context" length="20" defaultValue="DEFAULT"/>
            </fields>
            <conditions/>
            <actions/>
        </model>
        <model id="StateWithoutObject" limit="1" query="false" createrowifnonefound="true" adapter="salesforce" type="" doclone="" unloadwarningifunsavedchanges="false">
            <fields>
                <field id="Context" uionly="true" displaytype="TEXT" label="Context" length="20" defaultValue="DEFAULT"/>
            </fields>
            <conditions/>
            <actions/>
        </model>
    </models>
    <components>
        <pagetitle model="Account" uniqueid="sk-3kVVjf-99">
            <maintitle>Hit the button and check the console</maintitle>
            <actions>
                <action type="multi" label="UPDATE STATE WITH ACTIONS">
                    <actions>
                        <action type="updateRow" fieldmodel="StateWithoutObject" value="NEWVALUEFROMACTION" field="Context" enclosevalueinquotes="true"/>
                        <action type="custom" snippet="writeNewState"/>
                    </actions>
                </action>
                <action type="multi" label="UPDATE STATE WITH SNIPPET">
                    <actions>
                        <action type="custom" snippet="updateState"/>
                    </actions>
                </action>
            </actions>
        </pagetitle>
    </components>
    <resources>
        <labels/>
        <javascript>
            <jsitem location="inlinesnippet" name="writeNewState" cachelocation="false">var params = arguments[0],
	$ = skuid.$;
var stateModel2 = skuid.model.getModel('StateWithoutObject');
var stateRow2 = stateModel2.getFirstRow();
console.log('StateWithoutObject new Context value from action = ' + stateRow2.Context);</jsitem>
            <jsitem location="inline" name="writeDefaultState" cachelocation="false" url="">(function(skuid){
	var $ = skuid.$;
	$(document.body).one('pageload',function(){
        var stateModel2 = skuid.model.getModel('StateWithoutObject');
        var stateRow2 = stateModel2.getFirstRow();
        console.log('StateWithoutObject default Context value = ' + stateRow2.Context);
        stateModel2.updateRow(stateRow2, {Context: 'NEWVALUEFROMLOAD'});
        console.log('StateWithoutObject new Context value from load = ' + stateRow2.Context);        
	});
})(skuid);</jsitem>
            <jsitem location="inlinesnippet" name="updateState" cachelocation="false">var params = arguments[0],
	$ = skuid.$;
var stateModel = skuid.model.getModel('StateWithoutObject');
var stateRow = stateModel.getFirstRow(); 
stateModel.updateRow(stateRow, {Context: 'NEWFROMSNIPPET'});
console.log('StateWithObject new Context value from snippet = ' + stateRow.Context);</jsitem>
        </javascript>
        <css/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>

I can't see at all why the behaviour in my real page is different to this. Utterly baffling. It worked fine in Banzai.

So I've not been much use here. Back to the drawing board.
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,220 Points 5k badge 2x thumb
Glenn~

Thanks for the sample page. Sorry, that must have been very frustrating for you. Good news is that you'll still be able to do what you want to do on your page. Bad news is, now you gotta figure out what on your page is breaking what you're trying to do before you can keep doing what you want ... 

Glad it's somewhat resolved though! I'll let the dev team know a UI only model that's not connected to a Salesforce object works alright though.

Karen
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
I think I've solved the mystery.

The above test page works fine. But add a ui-only field to the StateWithoutObject model called "Id" and you can no longer update any field on the model's rows at all.

I've changed my original page now (renamed my old UI field "Id" to "Id1") and it's back to its former happy self.

Yay! I have no hair left and my spirit is broken, but ... yay!
(Edited)