mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Adding UI for reverse columns
Summary: - Adding an UI for two-way reference column. - Reusing table name as label for the reverse column Test Plan: Updated Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D4344
This commit is contained in:
@@ -1069,3 +1069,19 @@ export function computedOwned<T>(
|
||||
}
|
||||
|
||||
export type Constructor<T> = new (...args: any[]) => T;
|
||||
|
||||
/**
|
||||
* Simple memoization function that caches the result of a function call based on its arguments.
|
||||
* Unlike lodash's memoize, it uses all arguments to generate the key.
|
||||
*/
|
||||
export function cached<T>(fn: T): T {
|
||||
const dict = new Map();
|
||||
const impl = (...args: any[]) => {
|
||||
const key = JSON.stringify(args);
|
||||
if (!dict.has(key)) {
|
||||
dict.set(key, (fn as any)(...args));
|
||||
}
|
||||
return dict.get(key);
|
||||
};
|
||||
return impl as any as T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user