File tree Expand file tree Collapse file tree 7 files changed +16
-10
lines changed Expand file tree Collapse file tree 7 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,14 @@ let components = {
4747 "Warn" : Markdown .Warn .make ,
4848}
4949
50+ // the loadAllMdx function logs out all of the file contents as it reads them, which is noisy and not useful.
51+ // We can suppress that logging with this helper function.
52+ let allMdx = await Shims .runWithoutLogging (() => loadAllMdx ())
53+
5054let loader : Loader .t <loaderData > = async ({request }) => {
5155 let mdx = await loadMdx (request )
5256
53- let fileContents = await ( await loadAllMdx (~ filterByPaths = [ "docs" ]))
57+ let fileContents = await allMdx
5458 -> Array .filter (mdx => (mdx .path :> string )-> String .includes ("docs/manual/introduction" ))
5559 -> Array .get (0 )
5660 -> Option .map (mdx => mdx .path )
@@ -94,8 +98,6 @@ let default = () => {
9498
9599 let {categories , entries } = useLoaderData ()
96100
97- Console .log (entries )
98-
99101 let metaTitleCategory =
100102 (pathname :> string )-> String .includes ("docs/manual" )
101103 ? "ReScript Language Manual"
Original file line number Diff line number Diff line change 1- Console .log ("I am a dummy file" )
1+ Console .debug ("I am a dummy file" )
Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ let content = {
33 getLatest ()-> toXmlString
44}
55
6- Console .log (content )
6+ Console .debug (content )
Original file line number Diff line number Diff line change 1+ @module ("./shims.js" )
2+ external runWithoutLogging : (unit => Promise .t <'a >) => Promise .t <'a > = "runWithoutLogging"
Original file line number Diff line number Diff line change @@ -138,9 +138,6 @@ module H2 = {
138138 @react.component
139139 let make = (~id , ~children ) => {
140140 let title = childrenToString (children )-> String .toLowerCase -> String .replaceAll (" " , "-" )
141-
142- Console .log (title )
143-
144141 <>
145142 // Here we know that children is always a string (## headline)
146143 <h2 id className = "group mt-16 mb-3 hl-3 scroll-mt-32" >
Original file line number Diff line number Diff line change @@ -116,8 +116,6 @@ let make = (
116116 }}
117117 </div >
118118
119- Console .log2 ("activeToc" , activeToc )
120-
121119 let sidebar =
122120 <Sidebar isOpen = isSidebarOpen toggle = toggleSidebar preludeSection ?activeToc categories route />
123121
Original file line number Diff line number Diff line change 1+ export const runWithoutLogging = async ( fn ) => {
2+ const orig = console . log ;
3+ console . log = ( ) => { } ;
4+ const values = await fn ( ) ;
5+ console . log = orig ;
6+ return values ;
7+ }
You can’t perform that action at this time.
0 commit comments