Skip to content

Instantly share code, notes, and snippets.

@udfalkso
udfalkso / takeLatestPerActionAttr.js
Created Sep 23, 2019
redux saga takeLatestPerActionAttr more specific takeLatest
View takeLatestPerActionAttr.js
/*
* Custom variant on redux saga's takeLatest that allows us to resolve race condition for data updates
* based on something more specific than just the action type.
* This accepts an action type (e.g. FETCH_DATA) as well as a fn that that extracts a value from the action
* itself. (e.g. (a) => a.module.id) to get action attribute value. We can then effectively do a takeLatest for the action+value
* combination and ensure that only the latest action for each combo isn't cancelled.
* */
export const takeLatestPerActionAttr = (actionType, attrFn, saga, ...args) =>
fork(function*() {
const lastTasks = {}
@udfalkso
udfalkso / App.js
Last active Apr 6, 2018
"Portal" style modal that transfers content elsewhere without native code
View App.js
import ModalManager from "app/lib/ModalManager"
import styles from "./styles"
import React from "react"
import ReactNative from "react-native"
import { connect } from "react-redux"
const { StatusBar, View, StyleSheet, Platform } = ReactNative
class AppModal extends React.Component {
View keybase.md

Keybase proof

I hereby claim:

  • I am udfalkso on github.
  • I am udi (https://keybase.io/udi) on keybase.
  • I have a public key ASClxDVn_3eZwSvlFp5FKDgWlWQfpXQlxjiQY2xRq32-0Qo

To claim this, I am signing this object: