miolo 3.0.0-beta.207 → 3.0.0-beta.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/template/.env
CHANGED
package/template/package.json
CHANGED
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"intre": "^3.0.0-beta.4",
|
|
46
46
|
"joi": "^18.2.1",
|
|
47
47
|
"lucide-react": "^1.17.0",
|
|
48
|
-
"miolo-cli": "^3.0.0-beta.
|
|
48
|
+
"miolo-cli": "^3.0.0-beta.208",
|
|
49
49
|
"miolo-model": "file:../miolo-model",
|
|
50
|
-
"miolo-react": "^3.0.0-beta.
|
|
50
|
+
"miolo-react": "^3.0.0-beta.208",
|
|
51
51
|
"next-themes": "^0.4.6",
|
|
52
52
|
"radix-ui": "^1.4.3",
|
|
53
53
|
"react": "^19.2.7",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@biomejs/biome": "2.4.16",
|
|
65
|
-
"miolo": "^3.0.0-beta.
|
|
65
|
+
"miolo": "^3.0.0-beta.208",
|
|
66
66
|
"sass-embedded": "^1.100.0"
|
|
67
67
|
},
|
|
68
68
|
"overrides": {
|
|
@@ -17,7 +17,8 @@ const TodosProvider = ({ children }) => {
|
|
|
17
17
|
data: todoList,
|
|
18
18
|
setData: setTodoList,
|
|
19
19
|
refresh: refreshTodoList,
|
|
20
|
-
ready
|
|
20
|
+
ready,
|
|
21
|
+
invalidate: invalidateTodoList
|
|
21
22
|
} = useSsrData("todos", {
|
|
22
23
|
model: TodoList,
|
|
23
24
|
loader: useCallback(
|
|
@@ -33,7 +34,8 @@ const TodosProvider = ({ children }) => {
|
|
|
33
34
|
return data.sort((a, b) => b.created_at - a.created_at)
|
|
34
35
|
},
|
|
35
36
|
[useCrud, toast]
|
|
36
|
-
)
|
|
37
|
+
),
|
|
38
|
+
cache: true
|
|
37
39
|
})
|
|
38
40
|
|
|
39
41
|
const addTodo = useCallback(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { onTickFoo } from "./foo.mjs"
|
|
2
|
+
import { cacheInvalidate } from "./invalidate.mjs"
|
|
2
3
|
|
|
3
4
|
// check https://github.com/kelektiv/node-cron#readme
|
|
4
5
|
//
|
|
@@ -14,6 +15,13 @@ export default function init_cron() {
|
|
|
14
15
|
start: true
|
|
15
16
|
})
|
|
16
17
|
|
|
18
|
+
cronList.push({
|
|
19
|
+
name: "miolo-sample-cache-invalidate",
|
|
20
|
+
cronTime: "*/1 * * * *",
|
|
21
|
+
onTick: cacheInvalidate,
|
|
22
|
+
start: true
|
|
23
|
+
})
|
|
24
|
+
|
|
17
25
|
console.log(`[miolo-sample][cron] ${cronList.length} custom cron jobs loaded`)
|
|
18
26
|
|
|
19
27
|
return cronList
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { blue } from "tinguir"
|
|
2
|
+
|
|
3
|
+
export const cacheInvalidate = async (miolo) => {
|
|
4
|
+
miolo.logger.info(`${blue("[cron][cache_invalidate]")} Invalidating cache...`)
|
|
5
|
+
|
|
6
|
+
// broadcast an event to all clients
|
|
7
|
+
miolo.io.emit("ssr-invalidate", { name: "todos" })
|
|
8
|
+
|
|
9
|
+
miolo.logger.info(`${blue("[cron][cache_invalidate]")} Cache invalidated!`)
|
|
10
|
+
}
|