mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-29 08:07:48 +09:00
Here got rid from client-server env interop which will stop working outside of node-like environment.
25 lines
778 B
TypeScript
25 lines
778 B
TypeScript
// Our root outlet doesn't contain a layout because we have 2 types of documents: canvas and builder and we need to decide down the line which one to render, thre is no single root document.
|
|
import { Outlet, json, useLoaderData } from "@remix-run/react";
|
|
import { setEnv } from "@webstudio-is/feature-flags";
|
|
import env from "./env/env.server";
|
|
import type { ComponentProps } from "react";
|
|
import { useSetFeatures } from "./shared/use-set-features";
|
|
|
|
type OutletProps = ComponentProps<typeof Outlet>;
|
|
|
|
export const loader = () => {
|
|
return json({
|
|
features: env.FEATURES,
|
|
});
|
|
};
|
|
|
|
const Root = (props: OutletProps) => {
|
|
const { features } = useLoaderData<typeof loader>();
|
|
setEnv(features);
|
|
useSetFeatures();
|
|
|
|
return <Outlet {...props} />;
|
|
};
|
|
|
|
export default Root;
|