When executed, the page loads without errors. If a value is typed into the input, the server connect will execute and return the proper dataset.
If I navigate to another page, and then navigate back to this search, the input is now blank (expected) but if I type a different search term, the previous dataset is displayed. In dev console I can see that the server connect did not reload.
ok, the problem is different then I first was thinking. I thought the input change didn’t trigger any load, but it seems it does load. The problem seems to be related to the content that is being replaced on the page after navigation and it needs to bind to a new input which it doesn’t. If you move the serverconnect to the content page, does it then work correctly?
In App Connect 1 it did evaluate all expressions in the app on each update while in App Connect 2 it binds directly to the data and only updates when that data changes. In your case the navigation did remove the input it was listening to and later a new input was created which wasn’t bound. At least I think that is the case, will do some tests to verify and see if I can change the behavior that it binds to the new input after navigation.
Do you have many expressions on the main template page that point to components on some content page? Why do you have them on the template page and not on the content page?
You should always put components that are used only on a single content page on the page itself. There is no point of making them global when they are actually local to the content page. Our data pickers have never supported this.
Having them global and also doing a specific binding from the main page to a specific content page will be very error prone because the content page is not always there as it is usually loaded on demand.
So this is bad design - it might have worked on AC1 in a hacky manual way - because AC1 used to continuously reevaluate everything, but in AC2 everything is optimized and bindings are made one time from parent to child so it won’t work.
You should really consider using single responsibility pattern and put things where they belong and let them do as what they are supposed to do. This will make you main page also much lighter and content pages more dedicated.
Hi George,
Apologies if I have misunderstood but if you have global data such as common lists, used throughout multiple pages do you create a separate SC on each page for them? In Ken’s case meals that might be on the page in the video but are likely used elsewhere for tagify elements, dropdowns, lists, menus etc. Are you suggesting those lists (containing the same information) should be reloaded in a separate SC on each content page and no dynamic data should be pulled from the layout at all?
No it is the other way around - the global object refers to a specific data in a child object like content page - which is not always available. So it is difficult to have live binding to something that is not always there…
@mebeingken
Have you tried linking the parameter to a variable on the layout page instead and using the update event of your input to update the variable value? (assuming you don’t tidy it up as George suggested)
Thanks for this George and Patrick. I never really contemplated it, but what you say makes perfect sense. I don’t make a habit of doing it, and will look for any other mis-use across the app.