@cccsaurora/howler-ui 2.15.0-dev.310 → 2.15.0-dev.314

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.
@@ -14,6 +14,7 @@ const useTitle = () => {
14
14
  const sitemap = useMySitemap();
15
15
  const { getAnalyticFromId } = useContext(AnalyticContext);
16
16
  const hits = useContextSelector(HitContext, ctx => ctx.hits);
17
+ const getHit = useContextSelector(HitContext, ctx => ctx.getHit);
17
18
  const setTitle = useCallback((title) => {
18
19
  document.querySelector('title').innerHTML = title;
19
20
  }, []);
@@ -34,7 +35,10 @@ const useTitle = () => {
34
35
  }
35
36
  }
36
37
  else if (searchType === 'hit' && params.id) {
37
- const hit = hits[params.id];
38
+ const hit = hits[params.id] ?? (await getHit(params.id));
39
+ if (!hit) {
40
+ return;
41
+ }
38
42
  let newTitle = `${capitalize(hit.howler.escalation)} - ${hit.howler.analytic}`;
39
43
  if (hit.howler.detection) {
40
44
  newTitle += `: ${hit.howler.detection}`;
@@ -60,7 +64,7 @@ const useTitle = () => {
60
64
  setTitle(`Howler - ${t(matchingRoute.title)}`);
61
65
  }
62
66
  }
63
- }, [getAnalyticFromId, location.pathname, params.id, searchParams, hits, setTitle, sitemap.routes, t]);
67
+ }, [location.pathname, params.id, searchParams, getAnalyticFromId, setTitle, t, hits, getHit, sitemap.routes]);
64
68
  useEffect(() => {
65
69
  runChecks();
66
70
  }, [runChecks]);
@@ -46,7 +46,15 @@ const HandlebarsMarkdown = ({ md, object = {}, disableLinks = false }) => {
46
46
  setMdComponents(_components => ({ ..._components, [id]: result }));
47
47
  }
48
48
  }
49
- return new Handlebars.SafeString(`\`${id}\``);
49
+ /*
50
+ We add two newlines because:
51
+
52
+ ## Hello, World
53
+ `123123123`
54
+
55
+ does not parse as a code object.
56
+ */
57
+ return new Handlebars.SafeString(`\n\n\`${id}\``);
50
58
  }
51
59
  return helper.callback(...args);
52
60
  });
package/package.json CHANGED
@@ -96,7 +96,7 @@
96
96
  "internal-slot": "1.0.7"
97
97
  },
98
98
  "type": "module",
99
- "version": "2.15.0-dev.310",
99
+ "version": "2.15.0-dev.314",
100
100
  "exports": {
101
101
  "./i18n": "./i18n.js",
102
102
  "./index.css": "./index.css",
@@ -1,7 +1,7 @@
1
1
  import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
2
2
  import { Event } from 'react-pluggable';
3
- import type HowlerPlugin from './HowlerPlugin';
4
3
  import type { AppLeftNavElement } from '../commons/components/app/AppConfigs';
4
+ import type HowlerPlugin from './HowlerPlugin';
5
5
  export declare class HitEvent extends Event {
6
6
  hit: Hit;
7
7
  constructor(type: string, hit: Hit);