Multiple sessions (tabs open), how to make them unique

We have requirement from customer to create multiple sessions in one browser. Employees will open those tabs by just duplicating tabs (copy paste url). Multiple session means opening same view in the same browser but without sharing session data between those tabs. When I change e.g. date form field in one tab it should not be reflected in other tabs. How we can achieve that ? Thanks in advance

Every view is isolated in the client until you bind its fields to something. If you bind to gateway tags, those fields will be shared not just in every tab in that browser, but in every browser looking that same view. If you bind to session properties (custom or otherwise), then all tabs in that browser will share values, while other browsers (or private tabs) won’t. And so on to page properties and view properties (though you may not need any binding at the view level).

You can also bind through a view’s parameters, but the idea is the same. Isolated until bound.

What are you binding your components to?

Hi Phil thank you, i already tried what you have described and I see this behavior, tabs in same browser share updates, when I open incognito mode this mode does not share with normal mode, but when I open second incognito mode the incognito modes share updates (not with normal mode). We are binding data with view params. E.g. event on input text box → popup with values → value selected → value passed to message handler → python script fill the input text box with text and sets View parameter (in this scenario the text in input textbox is updated in every tab in the browser)

What is the scope of this message handler?

image

As shown, your handler is responding to all perspective scopes. So any view that sends an update anywhere in your session is being caught by all listeners. You want just page scope, or perhaps just view scope.

When I unchecked the Session box, it stopped working completely

Where is the message handler attached? (Should be to a component in the view to be updated.)

Hi Phil, thank you that worked ! Two pages can operate separately now, we are getting closer, next thing is we have a component (column table) with query binding and that binding is checking 3 view.params. When they change, sql query is fired. This is still not working and when query returns something on first page then I change something on second page the first page column table also gets the new query.

this has been setup on first page (4 components)
{‘shiftId’: u’2r’, ‘workerId’: u’1123’, ‘selectedDate’: u’08.12.2021’, ‘machineId’: u’PRU1’}

then I changed one thing on second page (shiftId) and you can see the same query has changed but is fired for both pages
{‘shiftId’: u’1n’, ‘workerId’: u’1123’, ‘selectedDate’: u’08.12.2021’, ‘machineId’: u’PRU1’}

How do you handle changing the params? Any message with scope session is send to everyt browser tab

I changed everything to Page, I have new finding

I moved props.data Query binding to script and I see two pages are sending different data
First page
{‘shiftID’: u’1n’, ‘workerID’: u’1123’, ‘selectedDate’: u’24.11.2021’}
Second page
{‘shiftID’: u’2r’, ‘workerID’: u’657’, ‘selectedDate’: u’08.12.2021’}

But changing second page inputs changes table on the first page too

show the binding on the table,
and the event that changes the params

All figured out :slight_smile:
All components have their own message handlers now.
Message handlers are set to Page scope only.
Within these handlers I call another message handler within the table component where data should be loaded (also with Page scope only) and everything runs okay now I have different results on two pages.

Thank you to both of you Phil and Victor :slight_smile:

Just for anybody who is interested this is the flow of some of these components. E.g. Text input → on click event opens modal where script name (name of message handler is passed), by closing modal the script is started which has this code here:

	messageType=str(self.view.params.callerMessageHandler)
	scope = "page"	
	system.perspective.sendMessage(messageType, returnValue, scope)

so it call the message handler of the Text input

Edit1: You can also have all message handlers in root and listen on Page but from design perspective its not recommended because of relative paths to components

Consider including unique IDs from your views or pages in the message handler payloads. Receiving message handlers can discard payloads with the wrong ID.

Thank you will keep in mind if it will occur