In Next.js 13, Why can't I use eventhandler in sever component? - next.js13

In the next.js 13 docs, it says that event handlers cannot be used in server components, but I wonder why. and Why are react hooks not available?

On the server, there are no user interactions. events are fired based on user interactions. That is why if a component has a button, it should be a client component because someone has to click on that button.
React hooks are related to the browser. they are basically a system that tells browsers when to recalculate certain computations or when to rerender the component based on dependencies. So based on user interactions, your app state will change, and based on this browser has to show the user new interface.

Related

How to open a Teams card action URL in a collaborative view instead of new browser window?

I have a bot that ultimately returns a hero card to a chat message box. This card has an action button that is currently configured to use openUrl, which spawns a new browser window upon click. We now have a requirement to display the same Url in a collaborative view within Teams (i.e. along-side a chat conversation).
I've seen similar functionality when sharing a document via a chat conversation, but can't seem to find any code samples that take this approach for a Url.
Is something like this possible and if so, any ideas how to best implement this approach?
When you use open URL action it will redirect to browser. This is by Design. But you open open the URL with in the task module when you click on the button, The page need to be publicly available and it should be IFrame. Also you need to add the URL domain to the valid domain, so that you can view the Page inside taskmodule without redirecting to browser. Please check this docs for more info

Wakanda Progress Indicator from Angular client

Looking for client side details / documentation on how to access the Wakanda server side progressIndicator details from an Angular application.
I find the latest server side docs on progressIndicator, but nothing on how to access these from the client.
In the old days of WAF, the communication was handled via the widget. I'm rewriting clients and do not find any documentation on the client side.
Thanks
In V1, WAF offers a widget to periodically connecting to the server using the name of progress indicator as the reference.
In V2, the progressIndicator is available in REST API via rest/$info/ProgressInfo.
The call to {ServerIP}/rest/$info/ProgressInfo will return an array of current progress indicators on the server side. Each object represents an active progress indicator containing information like value, max, start time, etc.
Below is a quick example of calling rest/$info/ProgressInfo with the example code from Wakanda doc. The two calls are about 5 seconds apart:
Notice the fValue has been updated on the server. The developer can check for the updated value periodically and present it in customized progress bar, tag or progress bar from libraries like Angular Material.
Hope this helps.
Updated Requirements for $info:
When Wakanda server is in Controlled Admin Access Mode, $info is only available to users in Admin group, this requires the user log in and have an active session that belongs to admin group. This is documented in $info doc page.
The Controlled Admin Access Mode is not implemented in 4D Web server so $info will always work when sent directly to 4D. But this is highly not recommended because you will not be able to manage sessions and each REST call will consume a new client license.
In order to use progress indicator via $info in your Wakanda app, I would recommend considering disabling Controlled Admin Access Mode by implementing custom authentication using login listeners.Or, use getProgressIndicator() in RPC/Dataclass methods to implement a new REST access to display progress indicator to all users.

Xamarin Forms UI Test

When doing UI Tests in Xamarin does the test also perform the logic behind a control when interacting with it (e.g. pressing the login button and performing login authentication) or its only plain UI interaction (logic behind a control is not performed)?
It tests the actual app, so pressing a button will fire the appropriate handlers, etc.
UI tests are more like UI commands that you send to your application. You check the UI state before an interaction and after an interaction (like the click of a button). Read more about it here https://blog.kloud.com.au/2018/05/08/enterprise-ready-testing-in-xamarin/. It has a sample app as well

Wicket Ajax bad network, server down, what is a good approach?

I'm currently having some network issues, and my Wicket application does not react very nicely to the network being sluggish or down. I.e. I see no reaction in my webpage, not even the AjaxIndicator.
What would be the approach to tackle shaky networks in Wicket Ajax? And how to present this to the user in such a way that it is not annoyong (like pop-ups etc).
The application is responsible to show Ajax indicator when needed. E.g. you can show it always, or show it only after a delay of N ms [1].
You can also use the browser navigator's online/offline events to tell the user that her connection is down [2].
https://github.com/apache/isis/blob/587a8bd622c9511389b92102c4308f6dd0dfabab/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js#L88-L96
https://developer.mozilla.org/en-US/docs/Online_and_offline_events

Access to SMS and browser content tombstoning

WP7 newbie here..
In my application, I am using embedded web browser control to load an external web page.
I have a PIN based validation step in that application, which involves
1) User Leaving the current application, (which has a external web page loaded in the embedded web browser) to launch the SMS Inbox.
2) User reads the SMS he just received, which has the PIN. I am sending this SMS to the user.
3) The User then needs to resume back to the original application by hitting back button, to enter the PIN which he received in the SMS earlier.
Once user enters Step2, my application will go into background, and subsequently will get tombstoned. Once user enter Step3, I want to restore application state (with the embedded web browser control), without making a fresh HTTP request again to load the web page.
So, with the given scenario in my mind, I have following two questions -
1) Is there a better way to do all this, like not having to exit the original application, and still let user read the SMS. ( i.e any api to read sms ?)
2) Is there a way to serialize the browser state/save entire web page (with images, css, js) , such that entire web page can be rendered exactly the way it was, when user left the running application.
Important points:
1) I can only use SMS as a communication channel. I can not use something like raw push notification channel, which could let me show PIN to the user, without exiting the application.
2) I am targeting Windows phone 7.0 runtime, but if there is a better option available in Windows Mango update, please do tell me.
Any sort of help is greatly appreciated.
Update:
Added link to the embedded web browser component.
1) There is no API that would let you access the contents of the Messaging hub from inside your application. This is set up for privacy purposes.
2) By default, the web browser saves its state. So if you navigate away from your app, and then come back - the same web page will still be there unless you explicitly re-navigate on activation
1) The better way to do this would be to not embed the web page within an app. Just build a mobile website. If all the functionality is within the web page you gain nothing but problems by trying to put it inside an app.
The web browser control is not intended to be used to create an alternative browser (which is really what you're doing).
2) You can try using the SaveToString() method to store the state of the page when tombstoned but this doesn't allow for modifications to the page since it was loaded (including anything dynamically updated or any state in javascript). If you have multiple pages you'll also need to maintain the internal backstack and the state of each page separately.
Short answer: If you want to put your application logic in a webBrowser control then you can't support tombstoning. Fast-App-Switching (in Mango) partially addresses this but not completely.

Resources