mirror of
https://github.com/plankanban/planka.git
synced 2025-12-28 09:15:02 +03:00
35 lines
753 B
JavaScript
35 lines
753 B
JavaScript
/*!
|
|
* Copyright (c) 2024 PLANKA Software GmbH
|
|
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
|
*/
|
|
|
|
import { createSelector } from 'redux-orm';
|
|
|
|
import orm from '../orm';
|
|
import { isLocalId } from '../utils/local-id';
|
|
|
|
export const makeSelectActivityById = () =>
|
|
createSelector(
|
|
orm,
|
|
(_, id) => id,
|
|
({ Activity }, id) => {
|
|
const activityModel = Activity.withId(id);
|
|
|
|
if (!activityModel) {
|
|
return activityModel;
|
|
}
|
|
|
|
return {
|
|
...activityModel.ref,
|
|
isPersisted: !isLocalId(activityModel.id),
|
|
};
|
|
},
|
|
);
|
|
|
|
export const selectActivityById = makeSelectActivityById();
|
|
|
|
export default {
|
|
makeSelectActivityById,
|
|
selectActivityById,
|
|
};
|