Skip to content

Commit

Permalink
Orama: Remove some ts-ignores and make the searchbox more explicit (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
TejasQ authored Apr 13, 2024
1 parent bf12663 commit 32656bb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@kobalte/core": "^0.12.6",
"@lunariajs/core": "^0.0.31",
"@orama/searchbox": "1.0.0-rc16",
"@orama/searchbox": "1.0.0-rc19",
"@oramacloud/client": "^1.0.14",
"@solidjs/meta": "^0.29.3",
"@solidjs/router": "^0.13.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions src/ui/searchbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { isServer } from "solid-js/web";
import {
RegisterSearchBox,
RegisterSearchButton,
RegisterSearchBoxProps,
RegisterSearchButtonProps,
} from "@orama/searchbox/dist/index.js";
import { OramaClient } from "@oramacloud/client";
import { createEffect } from "solid-js";
Expand All @@ -19,6 +21,10 @@ export function SearchBox() {

if (!isServer) {
createEffect(() => {
/**
* These function calls create/register web components like
* orama-searchbox and orama-search-button at runtime.
*/
RegisterSearchBox({
summaryGeneration: import.meta.env.VITE_ORAMA_SECURE_PROXY,
oramaInstance: client,
Expand Down Expand Up @@ -55,11 +61,18 @@ export function SearchBox() {
return (
<>
<div class="fixed z-10">
{/* @ts-ignore */}
<orama-searchbox />
</div>
{/* @ts-ignore */}
<orama-search-button />
</>
);
}

declare module "solid-js" {
namespace JSX {
interface IntrinsicElements {
"orama-searchbox": RegisterSearchBoxProps;
"orama-search-button": RegisterSearchButtonProps;
}
}
}

0 comments on commit 32656bb

Please sign in to comment.