FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Draft of fix for ChainableAttributeSpec being assigned to SharedType type attribute by remaininlight · Pull Request #54 · VoliJS/Type-R · GitHub

/ Type-R Public
forked from gaperton/Type-R

Draft of fix for ChainableAttributeSpec being assigned to SharedType type attribute - #54

Open
remaininlight wants to merge 5 commits into
VoliJS:developfrom
glia:develop
Open

Draft of fix for ChainableAttributeSpec being assigned to SharedType type attribute#54
remaininlight wants to merge 5 commits into
VoliJS:developfrom
glia:develop

Conversation

Copy link
Copy Markdown

When a shared type is used on a record in version 3.0.8 an error is thrown when assignment to it is attempted:

Uncaught TypeError: Right-hand side of 'instanceof' is not callable
at SharedType.convert (shared.ts:90)
at SharedType.doUpdate (shared.ts:56)
at setAttribute (updates.ts:56)
at AppState.set (any.ts:108)
at onEdit (main.jsx:69)
at HTMLUnknownElement.callCallback (react-dom.development.js:540)
at Object.invokeGuardedCallbackDev (react-dom.development.js:579)
at Object.invokeGuardedCallback (react-dom.development.js:436)
at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:450)
at executeDispatch (react-dom.development.js:834)

This seems to be because in these cases the type attribute on SharedType is a ChainableAttributeSpec rather than a Transactional type. This pull request is very crude, largely bypassing the type system, I'm not precisely sure how the type inheritance hierarchy is supposed to fit together - please advise how this PR could be improved.

You should be able to replicate the bug using an example such as this and assigning to the editing attribute:

@define class AppState extends Record {
static attributes = {
editing : shared(type(User)),
}
}

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL