How to Cancel a Redux Saga action?

I spent some time figuring out the answer to this question. This isn't a big deal if you are not really concerned about memory leaks or unnecessary operations (server request etc.) in your React Native (or React or where ever you are using redux-saga) application. Anyway, if you are here you care so let's dig into my specific problem and how to solve it.

Let's say you are using redux-saga to handle all of your API requests and every time you need some data you dispatch an action with request parameters and callbacks to handle the returned data, your action goes and finds the saga from the watchers you wrote and uses some generic request function to get the data. After getting your response you put your data in the hands of the callback to carry back to your page (you can also use a reducer to store your data but in this case let's say it doesn't make much sense to use). Well maybe in most cases the page will be there waiting to update the state with your data but sometimes the page closes and you see a warning saying something like don't try to update a state in an unmounted component. Read More


Saving Thumbnails to Disk with Intervention/Image | Lumen 8.0

Lumen Image Logo

Creating thumbnails is easy with intervention/image but saving them to a disk could be a little time-consuming. At least it was for me. I needed to spend some time to accomplish the task. Let's not consume any of your time...

First, add intervention/image to your project by running;

composer require intervention/image

Read More


Move Files Around | Lumen 8.0

Lumen

If you are using Lumen there is a good chance that you are using it for your mobile app. Maybe that's just me. Whatever the reason is moving files from sub-domain to parent -or another subdomain- is kinda tricky with Lumen. Laravel supports moving files from/to other folders. The only reason Lumen doesn't, it doesn't have a package called filesystem installed so let's get started by installing it.

composer require "league/flysystem: ~1.0"

We are forcing v1 because v2 doesn't work with Lumen.

Read More