mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
🐜 fix(zero): Fix zero throwing error about tables being undefined (#281)
## Description <!-- Briefly describe the purpose and scope of your changes --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new environment variable for improved configuration options. - **Chores** - Updated and locked dependency versions for enhanced stability. - Marked certain packages as private to prevent accidental publication. - Updated package metadata and trusted dependencies for better dependency management. - **Refactor** - Adjusted provider structure in the app to wrap children components with an additional context provider. - Simplified and cleaned up provider context code for maintainability. - Improved import statements for clarity and type safety. - **Style** - Reorganized import order for consistency. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "@nestri/www",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"dev": "vite",
|
||||
@@ -30,7 +31,7 @@
|
||||
"@nestri/zero": "*",
|
||||
"@openauthjs/openauth": "*",
|
||||
"@openauthjs/solid": "0.0.0-20250311201457",
|
||||
"@rocicorp/zero": "*",
|
||||
"@rocicorp/zero": "0.20.2025051800",
|
||||
"@solid-primitives/event-listener": "^2.4.0",
|
||||
"@solid-primitives/storage": "^4.3.1",
|
||||
"@solidjs/router": "^0.15.3",
|
||||
|
||||
@@ -8,6 +8,7 @@ import '@fontsource/geist-sans/800.css';
|
||||
import '@fontsource/geist-sans/900.css';
|
||||
import { Text } from '@nestri/www/ui/text';
|
||||
import { styled } from "@macaron-css/solid";
|
||||
import { ZeroProvider } from './providers/zero';
|
||||
import { TeamRoute } from '@nestri/www/pages/team';
|
||||
import { OpenAuthProvider } from "@openauthjs/solid";
|
||||
import { NotFound } from '@nestri/www/pages/not-found';
|
||||
@@ -107,7 +108,9 @@ export const App: Component = () => {
|
||||
<Text weight='semibold' spacing='xs' size="3xl" font="heading" >Confirming your identity…</Text>
|
||||
</FullScreen>
|
||||
}>
|
||||
{props.children}
|
||||
<ZeroProvider>
|
||||
{props.children}
|
||||
</ZeroProvider>
|
||||
</AccountProvider>
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -3,7 +3,6 @@ import { LibraryRoute } from "./library";
|
||||
import { useOpenAuth } from "@openauthjs/solid";
|
||||
import { Route, useParams } from "@solidjs/router";
|
||||
import { ApiProvider } from "@nestri/www/providers/api";
|
||||
import { ZeroProvider } from "@nestri/www/providers/zero";
|
||||
import { TeamContext } from "@nestri/www/providers/context";
|
||||
import { createEffect, createMemo, Match, Switch } from "solid-js";
|
||||
import { NotAllowed, NotFound } from "@nestri/www/pages/not-found";
|
||||
@@ -48,11 +47,9 @@ export const TeamRoute = (
|
||||
</Match>
|
||||
<Match when={team()}>
|
||||
<TeamContext.Provider value={() => team()!}>
|
||||
<ZeroProvider>
|
||||
<ApiProvider>
|
||||
{props.children}
|
||||
</ApiProvider>
|
||||
</ZeroProvider>
|
||||
<ApiProvider>
|
||||
{props.children}
|
||||
</ApiProvider>
|
||||
</TeamContext.Provider>
|
||||
</Match>
|
||||
</Switch>
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
import { useTeam } from "./context"
|
||||
// import { createEffect } from "solid-js"
|
||||
import { schema } from "@nestri/zero/schema"
|
||||
// import { useQuery } from "@rocicorp/zero/solid"
|
||||
import { useOpenAuth } from "@openauthjs/solid"
|
||||
import { Zero } from "@rocicorp/zero"
|
||||
import { schema } from "@nestri/zero/schema"
|
||||
import { useOpenAuth } from "@openauthjs/solid"
|
||||
import { useAccount } from "@nestri/www/providers/account"
|
||||
import { createInitializedContext } from "@nestri/www/common/context"
|
||||
|
||||
export const { use: useZero, provider: ZeroProvider } =
|
||||
createInitializedContext("ZeroContext", () => {
|
||||
const team = useTeam()
|
||||
const auth = useOpenAuth()
|
||||
const account = useAccount()
|
||||
const auth = useOpenAuth()
|
||||
const zero = new Zero({
|
||||
schema,
|
||||
storageKey: team().id,
|
||||
auth: () => auth.access(),
|
||||
userID: account.current.id,
|
||||
storageKey: account.current.id,
|
||||
server: import.meta.env.VITE_ZERO_URL,
|
||||
})
|
||||
|
||||
@@ -26,14 +22,4 @@ export const { use: useZero, provider: ZeroProvider } =
|
||||
client: zero,
|
||||
ready: true,
|
||||
};
|
||||
});
|
||||
|
||||
// export function usePersistentQuery<TSchema extends Schema, TTable extends keyof TSchema['tables'] & string, TReturn>(querySignal: () => Query<TSchema, TTable, TReturn>) {
|
||||
// const team = useTeam()
|
||||
// //@ts-ignore
|
||||
// const q = () => querySignal().where("team_id", "=", team().id).where("time_deleted", "IS", null)
|
||||
// createEffect(() => {
|
||||
// q().preload()
|
||||
// })
|
||||
// return useQuery<TSchema, TTable, TReturn>(q)
|
||||
// }
|
||||
});
|
||||
@@ -1,13 +1,17 @@
|
||||
{
|
||||
"name": "@nestri/zero",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@rocicorp/zero": "*",
|
||||
"@nestri/core": "*"
|
||||
"@nestri/core": "*",
|
||||
"@rocicorp/zero": "0.20.2025051800"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "zero-deploy-permissions && zero-cache",
|
||||
"generate": "zero-deploy-permissions --output-format=sql --output-file=permissions.sql"
|
||||
}
|
||||
},
|
||||
"trustedDependencies": [
|
||||
"@rocicorp/zero-sqlite3"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Size } from "@nestri/core/src/base-game/base-game.sql";
|
||||
import { type Limitations } from "@nestri/core/src/steam/steam.sql";
|
||||
import { ImageColor, ImageDimensions } from "@nestri/core/src/images/images.sql";
|
||||
import type { Size } from "@nestri/core/src/base-game/base-game.sql";
|
||||
import type { Limitations } from "@nestri/core/src/steam/steam.sql";
|
||||
import type { ImageColor, ImageDimensions } from "@nestri/core/src/images/images.sql";
|
||||
import {
|
||||
json,
|
||||
table,
|
||||
|
||||
Reference in New Issue
Block a user