This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: store initialStates * chore: update README * chore: add file comment * chore: rename type * fix: peer dependencies * fix: defineStoreConfig not found * feat: support get the appData * fix: test case * fix: lock
- Loading branch information
Showing
10 changed files
with
88 additions
and
10 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,3 +1,23 @@ | ||
import type { GetAppData } from 'ice'; | ||
import { defineAppConfig } from 'ice'; | ||
import { defineStoreConfig } from '@ice/plugin-store/esm/types'; | ||
|
||
export const store = defineStoreConfig(async (appData) => { | ||
return { | ||
initialStates: { | ||
...appData, | ||
}, | ||
}; | ||
}); | ||
|
||
export const getAppData: GetAppData = () => { | ||
return new Promise((resolve) => { | ||
resolve({ | ||
user: { | ||
name: 'icejs', | ||
}, | ||
}); | ||
}); | ||
}; | ||
|
||
export default defineAppConfig({}); |
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 |
---|---|---|
|
@@ -2,6 +2,6 @@ import { createModel } from 'ice'; | |
|
||
export default createModel({ | ||
state: { | ||
name: 'ICE 3', | ||
name: '', | ||
}, | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# @ice/plugin-store | ||
|
||
A plugin of state management base on Redux and React Redux used in framework `ICE`. | ||
|
||
## Usage | ||
|
||
```ts | ||
import { defineConfig } from '@ice/app'; | ||
import store from '@ice/plugin-store'; | ||
export default defineConfig({ | ||
plugins: [ | ||
store(), | ||
], | ||
}); | ||
``` | ||
|
||
## Options | ||
|
||
- disableResetPageState: 默认值是 `false`。开启后,切换页面再次进入原页面后不会重新初始化页面状态 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export interface StoreConfig { | ||
initialStates: Record<string, any>; | ||
} | ||
|
||
type Store = ((data?: any) => Promise<StoreConfig>) | StoreConfig; | ||
|
||
function defineStoreConfig(fn: Store) { | ||
return fn; | ||
} | ||
|
||
export { | ||
defineStoreConfig, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
d985198
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ice-v3 – ./
ice-v3-ice-v3.vercel.app
ice-v3.vercel.app
ice-v3-git-release-next-ice-v3.vercel.app