generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94646f3
commit 14b8fad
Showing
8 changed files
with
43 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
import { atom } from 'jotai'; | ||
import { atom, useAtom } from 'jotai'; | ||
import { atomFamily } from 'jotai/utils'; | ||
|
||
// TODO: use a request family | ||
export const landingPageDataAtom = atom(null); | ||
export const isRequestedAtom = atom(null); | ||
export const landingPageRequestFamily = atomFamily(() => atom()); | ||
|
||
export const useLandingPageRequest = (appName) => { | ||
const loadingAtom = landingPageRequestFamily(appName); | ||
return useAtom(loadingAtom); | ||
}; | ||
|
||
export const landingPageDataFamily = atomFamily(() => atom()); | ||
|
||
export const useLandingPageData = (appName) => { | ||
const loadingAtom = landingPageDataFamily(appName); | ||
return useAtom(loadingAtom); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { atom } from 'jotai'; | ||
import { atom, useAtom } from 'jotai'; | ||
import { atomFamily } from 'jotai/utils'; | ||
|
||
export const loadingFamily = atomFamily( | ||
() => atom(), | ||
(a, b) => a.appName === b.appName, | ||
); | ||
export const loadingFamily = atomFamily(() => atom()); | ||
|
||
export const useLoadingState = (appName) => { | ||
const loadingAtom = loadingFamily(appName); | ||
return useAtom(loadingAtom); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters