dmikester1
dmikester12y ago

✅ – ✅ – dmikester1 – 21-49 May 1

Can anyone see why this function is returning immediately with result being undefined?
7 Replies
dmikester1
dmikester1OP2y ago
const handlePartialSubmit = async (e) => {
e.preventDefault();
const result = await updatePalletCountAsync(
lineNum,
false,
lastPalletBagCount === '' ? 0 : lastPalletBagCount
);
console.log({ res2: result });
...
const handlePartialSubmit = async (e) => {
e.preventDefault();
const result = await updatePalletCountAsync(
lineNum,
false,
lastPalletBagCount === '' ? 0 : lastPalletBagCount
);
console.log({ res2: result });
...
And here is updatePalletCountAsync:
ScriptyChris
ScriptyChris2y ago
Can you share it on pastebin or something similar?
dmikester1
dmikester1OP2y ago
Here is the gist. Let me know if you need any other code. Thanks! https://gist.github.com/dmikester1/b4429ec0ff86105a0e0e7b1d562ad4f9
Gist
I split up the 2 functions into 2 different files for ease of readi...
I split up the 2 functions into 2 different files for ease of reading. They are actually in the same file. - handlePartialSubmit.js
dmikester1
dmikester1OP2y ago
do I need to promisify that second function? OK, so yes, I did indeed need to promisify that second function!
const updatePalletCountAsync = async (
lineNum,
subtract = false,
partial = 0
) => {
return new Promise(async (resolve, reject) => {
...
const updatePalletCountAsync = async (
lineNum,
subtract = false,
partial = 0
) => {
return new Promise(async (resolve, reject) => {
...
reactibot
reactibot2y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1102713436263170079
reactibot
reactibot2y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1102713436263170079 This thread hasn’t had any activity in 36 hours, so it’s now locked. Threads are closed automatically after 36 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1102713436263170079