@@ -46,6 +46,7 @@ module Category = {
46
46
}
47
47
48
48
type item = {
49
+ id : string ,
49
50
keywords : array <string >,
50
51
name : string ,
51
52
summary : string ,
@@ -55,27 +56,31 @@ type item = {
55
56
56
57
let allItems = [
57
58
{
59
+ id : "module-decorator" ,
58
60
keywords : ["@bs.module" ],
59
61
name : "@module" ,
60
62
summary : "This is the `@module` decorator." ,
61
63
category : Decorators ,
62
64
component : decorator_module ,
63
65
},
64
66
{
67
+ id : "as-decorator" ,
65
68
keywords : ["@bs.as" ],
66
69
name : "@as" ,
67
70
summary : "This is the `@as` decorator." ,
68
71
category : Decorators ,
69
72
component : decorator_as ,
70
73
},
71
74
{
75
+ id : "if-else" ,
72
76
keywords : ["if" , "else" , "if else" ],
73
77
name : "if / else" ,
74
78
summary : "This is the `if / else` control flow structure." ,
75
79
category : ControlFlow ,
76
80
component : controlflow_ifelse ,
77
81
},
78
82
{
83
+ id : "uncurried-function" ,
79
84
keywords : ["uncurried" ],
80
85
name : "(.) => {}" ,
81
86
summary : "This is an `uncurried` function." ,
@@ -152,7 +157,7 @@ let make = () => {
152
157
switch getAnchor (router .asPath ) {
153
158
| Some (anchor ) =>
154
159
Js .Array2 .find (allItems , item =>
155
- GithubSlugger .slug (item .name ) === anchor
160
+ GithubSlugger .slug (item .id ) === anchor
156
161
)-> Belt .Option .forEach (item => {
157
162
setState (_ => ShowDetails (item ))
158
163
})
@@ -172,15 +177,15 @@ let make = () => {
172
177
React .useEffect1 (() => {
173
178
switch (state , getAnchor (router .asPath )) {
174
179
| (ShowDetails (item ), Some (anchor )) =>
175
- let slug = GithubSlugger .slug (item .name )
180
+ let slug = GithubSlugger .slug (item .id )
176
181
177
182
if slug !== anchor {
178
183
router -> Next .Router .replace ("syntax-lookup#" ++ anchor )
179
184
} else {
180
185
()
181
186
}
182
187
| (ShowDetails (item ), None ) =>
183
- router -> Next .Router .replace ("syntax-lookup#" ++ GithubSlugger .slug (item .name ))
188
+ router -> Next .Router .replace ("syntax-lookup#" ++ GithubSlugger .slug (item .id ))
184
189
| (_ , Some (_ )) => router -> Next .Router .replace ("syntax-lookup" )
185
190
| _ => ()
186
191
}
0 commit comments