Your route is wrong, routes are promise aware (that's what hash is for), it should be:
model(params) {
return Ember.RSVP.hash({
invoice: this.store.findRecord('invoice',params.invoice_id)
//allShares: invoice.then((i)=>{return i.allShares()}),
//detailShares: invoice.then((i)=>{return i.detailShares()})
});
}
Then your handlebars is just:
{{#each model.invoice.invoiceLines as |line| }}
{{line}}
{{/each}}
You also shouldn't call methods like you are on a model. It's not really clear what allShares(), etc does but these should (probably) be computed in the controller. Something along the lines of:
import { computed } from '@ember/object';
export default Controller.extend({
allShares:computed('model.invoice', function(){
return this.get('model.invoice').allShares();
});
});
Though this doesn't seem ideal. Like I said, it's hard to be explicit as it's not clear what your trying to do here. It'd probably make more sense if your extracted these methods into a service.
You then don't need the helper at all. This appears to be just trying to work around promises.
It makes life a lot easier if you try and load all server side data in the route before load.
Status should = "Pending" if the cell is null
then() returning a null value when it should be pending
bug - Transaction pending status - blockNumber: null - Ethereum Stack Exchange
go ethereum - getTransaction sometimes returns null when transaction is pending - Ethereum Stack Exchange
Your route is wrong, routes are promise aware (that's what hash is for), it should be:
model(params) {
return Ember.RSVP.hash({
invoice: this.store.findRecord('invoice',params.invoice_id)
//allShares: invoice.then((i)=>{return i.allShares()}),
//detailShares: invoice.then((i)=>{return i.detailShares()})
});
}
Then your handlebars is just:
{{#each model.invoice.invoiceLines as |line| }}
{{line}}
{{/each}}
You also shouldn't call methods like you are on a model. It's not really clear what allShares(), etc does but these should (probably) be computed in the controller. Something along the lines of:
import { computed } from '@ember/object';
export default Controller.extend({
allShares:computed('model.invoice', function(){
return this.get('model.invoice').allShares();
});
});
Though this doesn't seem ideal. Like I said, it's hard to be explicit as it's not clear what your trying to do here. It'd probably make more sense if your extracted these methods into a service.
You then don't need the helper at all. This appears to be just trying to work around promises.
It makes life a lot easier if you try and load all server side data in the route before load.
First rule of helpers
Each time the input to a helper changes, the compute function will be called again.
Second, there's nothing about helpers that will make this block subsequent calls because you are returning a promise.
export function pricingsFullPricing([pricing]) {
return pricing.then(
p=>{
debugger
},p=>{
}
)
}
You've created a simple helper here that will use the promise itself as the value. Look at ember-promise-helpers/await to see how a class based helper is used to manually set the value that's displayed in the template.
Now, if you're wondering why the recomputation is happening, I'm going to have to speculate based off the knowledge I have of Ember data just from being part of the Ember community (I've never actually used Ember Data). You know line.pricing is a promise? I can then assume your using some sort of relationship, which will most likely have to be loaded via an ajax call (hence the promise). But these relationships in Ember data, iirc, use this PromiseProxyMixin that allow them to behave simultaneously like a promise or like an object (depending on whether the data is in the store already or not). This is what allows you to reference the promise in your template without then
See this article for a better understanding of what I mean
The only reasonable thing I can imagine is that the transaction was replaced by another with a larger fee.
Ethereum clients have a limit on how many transaction they can have in the pending pool at any moment. So transactions with lower fees can be dropped.
Since synchronization it is a p2p protocol some of the low fee transactions will keep appearing and disappearing over time.
Apparently this used to happen on the ropsten network.
I got it today from a light node on ropsten, even though the transaction had 10 confirmations.
It is possible that the getTransaction() request was sent to a peer which was a little bit behind?
Anyway, since this seems to be a rare and temporary issue, my solution has been to use a wrapper function that simply retries.
async getTransaction(transactionHash: string): Promise<Tx> {
for (let attempt = 1; attempt <= 60; attempt++) {
const transaction = await web3.eth.getTransaction(transactionHash);
if (transaction) return transaction;
await delay(10 * 1000);
}
throw new Error(`Failed to receive transaction from getTransaction("${transactionHash}")`);
},
For the same reason, I do exactly the same for getTransactionReceipt().
I tried adding my gift card to Paypal, but it asked me to confirm. I clicked okay, and I got an error saying to try again later. I went to the vanilla gift website, and there is "Visa Provisioning Service - NULL" under the transactions. I wondered if this was the issue and how long it takes to clear.
This question is two years old by now. But I wanted to answer, because the original answer is not the correct explanation. As the comment says, Geth does not require transactions be mined before making them available on the getTransaction() API.
Rather, the issue is that Geth's txPool consistency model is not full read-after-write. When a tx hash is published to the subscriber, it is not guaranteed to be processed for serving on the API. If you try to fetch getTransaction() immediately after, you may hit a race condition and get a null (i.e. not found) result.
The solution isn't to wait for the next block to be mined, it's to retry in a short interval. Geth does support eventual consistency, typically on the scale of milliseconds, so you will see it well before the next block.
when transaction is just submitted into network, its still pending, you need to wait for it to be mined then only the web3.eth.getTransaction return correct value, put in in the loop with settimeout.
PendingIntent contentIntent = PendingIntent.getActivity(
getApplicationContext(),
0,
new Intent(), // add this
PendingIntent.FLAG_UPDATE_CURRENT);
The following works and seems more straightforward:
PendingIntent pi = PendingIntent.getActivity(context, 0, null, 0);
Having a notification without launching a subsequent Activity seems quite sensible to me - eg "Its time to get up!.