-
hey @DZakh & team, this is a question about the new
Does this mean that we can use At the moment, we are doing this: const loader: Loader<LoaderReturn> = async ({ context, event }) => {
const watcher = await Store.Watcher.get(context, event.chainId);
return {
watcher,
};
};
const handler: Handler<LoaderReturn> = async ({ context, event, loaderReturn }) => {
const { watcher } = loaderReturn;
if (!watcher) {
throw new Error(`Watcher not loaded from the entity store: ${chainId}`);
}
// <--- snip --->
}; Can we replace this pattern with: const loader: Loader<LoaderReturn> = async ({ context, event }) => {
- const watcher = await Store.Watcher.get(context, event.chainId);
+ const watcher = await context.Watcher.getOrThrow(context, event.chainId);
return {
watcher,
};
}; And then, in the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Yes, you can replace it. It will have the same behavior as the example with the handler. |
Beta Was this translation helpful? Give feedback.
-
And a related question: is it alright to use |
Beta Was this translation helpful? Give feedback.
Yes, you can replace it. It will have the same behavior as the example with the handler.