New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Feature/23 serializable actions #55
Conversation
src/core/action.ts
Outdated
function deserializeArgument(adm: Node, value: any): any { | ||
if (typeof value === "object") { | ||
const keys = Object.keys(value) | ||
if (keys.length === 1 && keys[0] === "$path") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Use $ref instead or keep as is and change referenceTo return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/types/reference.ts
Outdated
@@ -16,7 +16,10 @@ export interface IReferenceDescription { | |||
|
|||
export function referenceTo<T>(path: string): T; | |||
export function referenceTo<T>(getter: IReferenceGetter<T>, setter?: IReferenceSetter<T>): T; | |||
export function referenceTo<T>(factory: IFactory<any, T>): T; | |||
export function referenceTo(arg1, arg2?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Maybe export as "reference" to be consistent with other types and more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const base = getNode(owner) | ||
const target = getNode(value) | ||
invariant(base.root === target.root, `The value assigned to the reference '${name}' should already be part of the same model tree`) | ||
return getRelativePath(base, target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Maybe return as {$path: "..."} or {$ref: "..."}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added TODO to code
No description provided.