mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 05:26:24 +09:00
## Description closes #4403 We have no way to show good errors on naviagation errors (remix does not support this) Here I reduced amount of reloads on link clicks on preview ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
29 lines
767 B
TypeScript
29 lines
767 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,
|
|
type ShouldRevalidateFunction,
|
|
} from "@remix-run/react";
|
|
import { setEnv } from "@webstudio-is/feature-flags";
|
|
import env from "./env/env.server";
|
|
import { useSetFeatures } from "./shared/use-set-features";
|
|
|
|
export const loader = () => {
|
|
return json({
|
|
features: env.FEATURES,
|
|
});
|
|
};
|
|
|
|
export default function App() {
|
|
const { features } = useLoaderData<typeof loader>();
|
|
setEnv(features);
|
|
useSetFeatures();
|
|
|
|
return <Outlet />;
|
|
}
|
|
|
|
export const shouldRevalidate: ShouldRevalidateFunction = () => {
|
|
return false;
|
|
};
|