5ba68e997d
* create scopes * fix import bug * add useView hook * wip * wip * currentViewId is now retrieved via useView * working on sorts with useView * refactor in progress * refactor in progress * refactor in progress * refactor in progress * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix code * fix code * wip * push * Fix issue dependencies * Fix resize --------- Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
23 lines
601 B
TypeScript
23 lines
601 B
TypeScript
import { selectorFamily } from 'recoil';
|
|
|
|
import { View } from '@/views/types/View';
|
|
|
|
import { currentViewIdScopedState } from '../currentViewIdScopedState';
|
|
|
|
import { viewsByIdScopedSelector } from './viewsByIdScopedSelector';
|
|
|
|
export const currentViewScopedSelector = selectorFamily<
|
|
View | undefined,
|
|
string
|
|
>({
|
|
key: 'currentViewScopedSelector',
|
|
get:
|
|
(scopeId) =>
|
|
({ get }) => {
|
|
const currentViewId = get(currentViewIdScopedState({ scopeId: scopeId }));
|
|
return currentViewId
|
|
? get(viewsByIdScopedSelector(scopeId))[currentViewId]
|
|
: undefined;
|
|
},
|
|
});
|