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.

API adjustments needed

See original GitHub issue

The current API of view, actions and events boils down to this single function signature:

(state, actions, data)

Inside an app call it looks like this:

app({
  view(state, actions) {

  },
  action: {
    someAction(state, actions, data)
  },
  events: {
    load(state, actions, root) {

    },
    render(state, actions, view) {

    },
    action(state, actions, data) {

    },
    resolve(state, actions, data) {
        
    },
    update(state, actions, data) {

    }
  }
})

This is usually good enough, but we still have couple of loose ends. How to know which action triggered a state update? How to know the name of the action inside events.resolve? There are workarounds, but nothing good yet.

#339 is a good start, but it means some events signature would change to this:

resolve(state, actions, data, { action, data })

and

update(state, actions, newState, { action, data })

which is not as elegant as I would hope, but if it’s the best we can do then so be it.

I would like to explore alternatives in this thread.

I don’t think there are unlimited possibilities, we just need to make sure we can accommodate action information for resolve and update.

If you have any ideas, please share them. I’ll be adding proposals to this issue as I come up with them.

👋

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
jorgebucarancommented, Aug 27, 2017

This would involve changing how actions and view work (because we are trying to keep the same signature everywhere). So, while nested destructuring is really nice, I am swaying towards this instead.

// everything else remains the same

action  (state, actions, { name, value })
resolve (state, actions, { name, value })
update  (state, actions, { name, value })
1reaction
jorgebucarancommented, Aug 27, 2017

But a single object is pretty cool too… 😏

Tough decisions! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Oracle Assets Adjustments API Documentation Supplement
The Adjustments API allows you to automatically adjust the asset to the corporate book, as well as to the dependent tax books. Oracle...
Read more >
Make billing adjustments | Apigee Edge
If you need to apply an adjustment to multiple API products, create an adjustment for each product. Select an API product from the...
Read more >
About Adjustments
An adjustment is a transaction that modifies the balance in a customer account. In the Galileo Program API, you can make an adjustment...
Read more >
Upload Conversion Adjustments | Google Ads API
Here are some things to keep in mind while adjusting conversions in the API: Only the account that manages conversion actions is able...
Read more >
Introduction to FHIR® Reasonable Adjustments API
Important: This site is under active development by NHS Digital and is intended to provide all the technical resources you need to successfully...
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