Skip to content

Instantly share code, notes, and snippets.

@dvtng
Last active June 10, 2020 01:13
Show Gist options
  • Save dvtng/5c57b510d577782d23c6196b9dfdf471 to your computer and use it in GitHub Desktop.
Save dvtng/5c57b510d577782d23c6196b9dfdf471 to your computer and use it in GitHub Desktop.
const dispatch = useDispatch()
await dispatch(OrderRecord.issueCreate(
{ /* no static typing */ }
)).meta.promise
// Refresh all OrderRecords,
// to ensure the account history page is up-to-date
const refresh1 = dispatch(OrderRecord.issueQuery({}, {
fetchLimit: 0
})).meta.promise
// Also refresh OrderRecords filtered by this instrumentId,
// to ensure the stock detail page is up-to-date
const refresh2 = dispatch(OrderRecord.issueQuery({
queryParams: { instrumentId /* no static typing */ }
}, { fetchLimit: 0 })).meta.promise
// Await on both refreshes so we're not doing it in sequence
await Promise.all([refresh1, refresh2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment