Serious Observable bug in 0.25

Apparently the observable on Page 2 gets detached after going away from the page and navigating again to it. Although in JS the observable contains the right values, in UX it becomes blank.

<App>

	<Page ux:Class="AppPage">
		<Router ux:Dependency="router" />
	</Page>

	<ClientPanel>
		<Router ux:Name="router" />

		<Navigator DefaultTemplate="page1">
			<AppPage ux:Template="page1" router="router">
				
				<JavaScript>
				module.exports = { next: function() { router.goto('page2'); } }
				</JavaScript>

				<StackPanel>
					<Text Value="Page 1" />
					<Button Text="Goto 2">
						<Clicked Handler="{next}" />
					</Button>
				</StackPanel>
			</AppPage>
			<AppPage ux:Template="page2" router="router">
				
				<JavaScript>
				var Observable = require('FuseJS/Observable'),
					items = Observable();

				function onActivated()
				{
					console.log('called');
					// items.clear();
					items.add({ text: 1 });
				}

				module.exports = {
					onActivated: onActivated,
					items: items,
					next: function() { router.goto('page1'); }
				};
				</JavaScript>

				<Activated>
					<Callback Handler="{onActivated}" />
				</Activated>

				<StackPanel>
					<Text Value="Page 2" />
					<Button Text="Goto 1">
						<Clicked Handler="{next}" />
					</Button>
					<Each Items="{items}">
						<Text Value="{text}" />
					</Each>
				</StackPanel>
			</AppPage>
		</Navigator>
	</ClientPanel>
</App>

Where did you get the 0.25 version from?

Damn, they were right - I should have kept quiet :stuck_out_tongue:
/downloads/channel/qa
But that is a possibly not yet production ready version, so try it at your own risk.
Given the issue above, I would suggest you wait for a new release.

Perhaps fuse should ask for some metadata when creating a new forum thread. Like OS, and Fuse version, and device. Then everything could be filtered specifically. :slight_smile:

Btw if I’m understanding your problem correctly, I don’t think its a bug, the Observable should clear, because Navigator gets rid of that view and recycles it when needed, which means the JS is also recycled therefore the Observable would be cleared. What you want to do is store the data, on storage, or perhaps as a JS module and then require it everytime that view is activated. Kind of like how hikes.js is setup here: https://www.fusetools.com/docs/tutorial/splitting-up-components

It is a bug first of all because it used to work and second because the gui ignores the values in the observable starting with the second load.
Strange bonus behaviour: an items.add in the global scope, above the onActivated handler, gets picked up every time.

Perhaps fuse should ask for some metadata when creating a new forum thread. Like OS, and Fuse version, and device. Then everything could be filtered specifically. :slight_smile:

That was one of the usage patterns for the new forum we considered but decided against because it would lead to more noise and confusion (some users would fill it in, others wouldn’t, making the data unreliable). In addition, that type of data is likely to change as the troubleshooting process began, so what was then declared when the thread began wouldn’t necessarily be relevant or accurate further down in the discussion, leading to further confusion.

One other usage question: the new Activated trigger accepts a Handler attribute, but passing a js function name ({handler}) yields an argument type error. What is the use of that parameter?
Thanks

What version did you update from? I just tested this example in 0.24 and 0.25, it behaved just the same.

Bug posted for .25. On .24 I had a trigger on whileactive, which was behaving rather ok (think it was making more calls than necessary)

When I test your example, the behavior I observer and that you described happen in 0.25, when I test in 0.24 to see if this is a regression it behaves just the same there.

Can you share the code you used in 0.24 where you say it worked?

Can’t retest now and the source code is rather large.
But all in all it appears to be a problem, right? I mean that observable should never appear blank in the ui…
I will try to test the example on .24 the first chance I get. I only tried to replicate the peoblem, haven’t actually checked this exact sample on .24.

Indeed, on that sample it seems to behave the same on .24. Yet, it’s still a bug. May not be a regression, though.
Sorry about the confusion.
In the original code, on that exact page I may have just called a loading function outside any handler, which meant it was loading it on each navigation event. When I tried placing the logic inside Activated, which seemed more logical than executing a function upon loading the JS file, that happened.

Hey,
any idea if this issue will be addressed? Thanks!

It’s being worked on. Keep in mind that 0.25 isn’t officially released yet. :slight_smile:

Oh, I know. But I like to think I’m preventing others bashing their heads against their desks when something like this happens. Although you do all the hard work :smiley:

Maybe it helps: the same example works fine if we’re using a LinearNavigation instead of the Navigator.
Activated gets properly called and the observable is carried over nicely.

<Panel>
  <LinearNavigation Easing="CircularOut" Active="page1" />
  <SwipeNavigate ForwardDirection="Right" />
  ...

Has anything happened to this? On 0.25.3, it seems Observables still get confused inside Activated triggers.

I am facing the same problem… Fuse Version 0.27.1 Build 7935
Observable leaves a blank space in UI when i change a Page although i tested the Observable to see if it has any null or empty fields but always is filled with the exact number of items i pass to it.

<Panel ux:Name="pageControl">
	<LinearNavigation ux:Name="navigation">
		<NavigationMotion GotoEasing="CircularOut" GotoDuration="0.5" Overflow="Open"/>
	</LinearNavigation>
	<Each Items="{movieList}">
		<MovieCard/>
	</Each>
</Panel>

this is the code that i create the movieCards and when i run it for the

first time :

and every other time or if i navigate to another page and back i see this :

Fotis: I wouldn’t assume this is the same problem. Please repost in a separate thread with a complete reproduction case of your issue.

Costin: Is your problem still present in 0.27 ? If so, can you verify whether the console.log happens on second activation of Page 2?

Sorry for the late reply, had my PHP hat on for a while.
The issue is still there and still strange. On .28. With the code at the top, even if in the console I see “called” each time I reach page 2, I only see the number added into the items var the first time the page is visited.