There’s two problems here conceptually:
yield importFile()is going to pass
undefinedto the saga middleware, which will presumably keep right on going
- The file reader will not execute the callback right away, and your code really needs to wait until it’s done.
You’ll need to restructure the code so that it waits until the reader logic is done.
One option might to be to manually create a
Promise inside of
importFile and return it, and resolve the promise at the end of the
CLICK HERE to find out more related problems solutions.