question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

display async messages coming from backend system

See original GitHub issue

A often use case is to register/login users. Sometimes we need to display error messages like “Invalid Password” or something else, coming from a backend system. It would be nice, if i can use svelte-use-form to display these errors too, maybe like this:

function submit() {
   login(email, password)
      .then(() => { // do something with the response })
      .catch(e => {
         if (e.message.includes("Invalid Password")) {
            form.email.errorMap = "Wrong Password, please try again"
         }
      })
}

I don’t know to what extent it is possible to store error messages in the ErrorMap that are not assigned to a validator. However, this error could then be displayed via this code dynamic:

Object.values($form.email.errors)[0]

I know the goal of this repo is to be easy to use. Nevertheless I would be happy if we could find a way to cover this use case.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
noahsalvicommented, Mar 17, 2021

Haha yes I’ve worked with flutter but at the moment I’m kind of busy with work and soon I’ll also be starting my studies 😬 If anything changes I’ll get in touch

1reaction
noahsalvicommented, Mar 16, 2021

This is now supported in 2.3.0

$form.controlName.error({ errorName: "Some text" });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Asynchronous Messaging, Part 4: Retrieve Results
So far in this series, we've covered how asynchronous messaging can be implemented with a durable queue and a backend service.
Read more >
Asynchronous message-based communication - Microsoft Learn
When using messaging, processes communicate by exchanging messages asynchronously. A client makes a command or a request to a service by sending ...
Read more >
Managing backend requests and frontend notifications ... - AWS
Many front-end applications pass requests for processing, wait for a result, and then display this to the user. This synchronous approach is ...
Read more >
How To Handle Async Data Loading, Lazy Loading, and Code ...
React has a special component called Suspense that will display placeholders while the browser is loading your new component. In future versions ...
Read more >
What are synchronous/asynchronous APIs? - TechTarget
The API may have to wait for a backend response. These APIs may provide a callback notification to the requester when the requested...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found