-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Issue Summary
A TypeError occurs within the useAction hook of the Blinks SDK when attempting to use a finally block after a promise chain.
Steps to Reproduce
- Integrate the Blinks SDK within a React component using the
useActionhook. - Trigger the component that executes the
useActionhook. - Observe the console for any errors during the action fetching process.
Error Message
ERROR TypeError: _chunk3VHJSHHRcjs.Action.fetch(a(...)", e); setAction(null); }).finally is not a function (it is undefined)
Code Snippet
useEffect(() => {
setIsLoading(true);
if (!isRegistryLoaded || !actionApiUrl) {
return;
}
let ignore = false;
_chunk3VHJSHHRcjs.Action.fetch(actionApiUrl, void 0, supportStrategy).then((action2) => {
if (ignore) {
return;
}
setAction(action2);
}).catch((e) => {
console.error("[@dialectlabs/blinks] Failed to fetch action", e);
setAction(null);
}).finally(() => {
if (!ignore) {
setIsLoading(false);
}
});
return () => {
ignore = true;
};
}, [actionApiUrl, isRegistryLoaded]);Suggested Fix
Removing the finally block resolves the error and allows the component to function, but this is not ideal. A better fix would be to ensure that the Promise implementation in the environment includes finally or to add a polyfill.
Environment
- React Native version:
0.74.3 react-native-picker-selectversion:^9.1.3@dialectlabs/blinksversion:^0.8.0@dialectlabs/blinks-react-nativeversion:^0.2.0
Metadata
Metadata
Assignees
Labels
No labels