Commit e4b1d0ea authored by Robert Knight's avatar Robert Knight

Add missing types in drafts store module

parent 1f2d750e
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import * as metadata from '../../helpers/annotation-metadata';
import { createStoreModule, makeAction } from '../create-store'; import { createStoreModule, makeAction } from '../create-store';
import { removeAnnotations } from './annotations'; import { removeAnnotations } from './annotations';
/** @typedef {import('../../../types/api').Annotation} Annotation */ /**
* @typedef {import('redux-thunk/extend-redux')} Dummy
* @typedef {import('../../../types/api').Annotation} Annotation
*/
/** /**
* The drafts store provides temporary storage for unsaved edits to new or * The drafts store provides temporary storage for unsaved edits to new or
...@@ -117,10 +119,14 @@ function createDraft(annotation, changes) { ...@@ -117,10 +119,14 @@ function createDraft(annotation, changes) {
* An empty draft has no text and no reference tags. * An empty draft has no text and no reference tags.
*/ */
function deleteNewAndEmptyDrafts() { function deleteNewAndEmptyDrafts() {
/**
* @param {import('redux').Dispatch} dispatch
* @param {() => { drafts: State }} getState
*/
return (dispatch, getState) => { return (dispatch, getState) => {
const newDrafts = getState().drafts.filter(draft => { const newDrafts = getState().drafts.filter(draft => {
return ( return (
metadata.isNew(draft.annotation) && !draft.annotation.id &&
!getDraftIfNotEmpty(getState().drafts, draft.annotation) !getDraftIfNotEmpty(getState().drafts, draft.annotation)
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment