singleton.server.ts — ui Source File
Architecture documentation for singleton.server.ts, a typescript file in the ui codebase. 0 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 8167d6e6_66e4_311f_1efe_6e8c96f8300b["singleton.server.ts"] 3c6e6fdb_9408_976e_ecfd_d942617df11b["db.server.ts"] 3c6e6fdb_9408_976e_ecfd_d942617df11b --> 8167d6e6_66e4_311f_1efe_6e8c96f8300b style 8167d6e6_66e4_311f_1efe_6e8c96f8300b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// Since the dev server re-requires the bundle, do some shenanigans to make
// certain things persist across that 😆
// Borrowed/modified from https://github.com/jenseng/abuse-the-platform/blob/2993a7e846c95ace693ce61626fa072174c8d9c7/app/utils/singleton.ts
export const singleton = <Value>(
name: string,
valueFactory: () => Value,
): Value => {
const g = global as unknown as { __singletons: Record<string, unknown> };
g.__singletons ??= {};
g.__singletons[name] ??= valueFactory();
return g.__singletons[name] as Value;
};
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does singleton.server.ts do?
singleton.server.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, CLICore subdomain.
What functions are defined in singleton.server.ts?
singleton.server.ts defines 1 function(s): singleton.
What files import singleton.server.ts?
singleton.server.ts is imported by 1 file(s): db.server.ts.
Where is singleton.server.ts in the architecture?
singleton.server.ts is located at packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app/singleton.server.ts (domain: FrameworkTooling, subdomain: CLICore, directory: packages/shadcn/test/fixtures/frameworks/remix-indie-stack/app).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free