openlawteam/openlaw-client

Deal does not render in browser, isDeal should return true.

Closed this issue · 6 comments

Source
From the community slack User: Tristan Roberts
Instance: etherizeit.openlaw.io
Relevant code
https://pastebin.com/Y0HdG7bi
@jdville03 or whovever else spots. Message @mcchan1 for the user's full zip file.

Problem:
Deal package of templates not rendering in the browser. A single template renders as expected.
"isDeal" returns false.

Expected Behavior:

  • Deal package of templates should render in browser.
  • "isDeal" should return "true"

Was able to replicate as follows:

  1. "test-deal" on the user's OL instance works from the OpenLaw app.
  2. isDeal returns "false" when it should return "true"
  3. User's Create.js file works as expected when only one template.
  4. When 'test-deal' was the template. console logged executionResult in the user's executeTemplate and previewTemplate and an error was returned.

PLZ HELP 😿

@jtrein do you mind taking a look into this when you get a chance?

I've been playing with Deals using Etherizeit instance, and it seems like I ran into another bug, that
may or may not be related to this issue.
The Deal:
https://lib.openlaw.io/web/etherizeit/template/deal-entity

At the bottom, I've included:
[[Agent Agreement: Template("information-entity")]]
[[Organizer Agreement: Template("service-agreement-organizer")]]

But when I switch back to the main view (to insert data; the first view on the Deal)... there is nothing. I checked the console and it says the errors posted below...

Now - the weird part - is that at points it seemed like I was being directed to https://lib.openlaw.io/web/template/deal-entity ... that is to say, the deal's name on OL's main instance (which doesn't exist as of writing this) instead of Etherizeit instance! I can't seem to replicate it right now. But this might be the solution to this bug and this issue... the code is trying to pull agreements from OL's main instance instead of the instance calling it.


2
TemplateEditor-1e9fc…2ac25a.bundle.js:36 Uncaught (in promise) TypeError: Cannot read property 'agreement' of undefined
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at u (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at m (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at dispatch (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…f2ac25a.bundle.js:1
at l (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator._invoke (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator.forEach.e. [as next] (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at $ (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
at a (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
sentry.admin.dev.ope…b9c8c4df2e6c8bb1e:1 Failed to load resource: the server responded with a status of 400 ()
12
TemplateEditor-1e9fc…2ac25a.bundle.js:36 Uncaught (in promise) TypeError: Cannot read property 'agreement' of undefined
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at u (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at m (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at dispatch (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…f2ac25a.bundle.js:1
at l (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator._invoke (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator.forEach.e. [as next] (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at $ (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
at a (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
25
TemplateEditor-1e9fc…2ac25a.bundle.js:36 Uncaught (in promise) TypeError: Cannot read property 'agreement' of undefined
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at u (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at m (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at dispatch (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…f2ac25a.bundle.js:1
at l (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator._invoke (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator.forEach.e. [as next] (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at $ (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
at a (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
316
TemplateEditor-1e9fc…2ac25a.bundle.js:36 Uncaught (in promise) TypeError: Cannot read property 'agreement' of undefined
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at u (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at m (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at dispatch (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…f2ac25a.bundle.js:1
at l (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator._invoke (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator.forEach.e. [as next] (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at $ (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
at a (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
raven.js:58 Invariant Violation: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=TypeError%3A%20Cannot%20read%20property%20'agreement'%20of%20undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:424
at i (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:529)
at pl (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:47293)
at https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:52054
at Ta (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:58968)
at Ua (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:67342)
at Qi (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:90620)
at Ki (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:91004)
at Uo (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:98032)
at zo (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:97412)
at Mo (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:98508)
at Object.notify (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:24:29339)
at e.t.notifyNestedSubs (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:24:28919)
at e.t.handleChangeWrapper (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:24:28987)
at m (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:36:1221822)
at https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:36:1212670
at Object.registerError (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:124:164951)
at https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:124:154386
TemplateEditor-1e9fc…2ac25a.bundle.js:36 Uncaught (in promise) TypeError: Cannot read property 'agreement' of undefined
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at u (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at m (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…2ac25a.bundle.js:36
at dispatch (TemplateEditor-1e9fc…2ac25a.bundle.js:36)
at TemplateEditor-1e9fc…f2ac25a.bundle.js:1
at l (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator._invoke (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at Generator.forEach.e. [as next] (TemplateEditor-1e9fc…2ac25a.bundle.js:42)
at $ (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
at a (TemplateEditor-1e9fc…f2ac25a.bundle.js:1)
deal-entity:1 Uncaught (in promise) Invariant Violation: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=TypeError%3A%20Cannot%20read%20property%20'agreement'%20of%20undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:424
at i (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:529)
at pl (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:47293)
at https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:52054
at Ta (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:58968)
at Ua (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:67342)
at Qi (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:90620)
at Ki (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:91004)
at Uo (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:98032)
at zo (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:97412)
at Mo (https://lib.openlaw.io/assets/build/js/vendors-react-5f0b529….bundle.js:17:98508)
at Object.notify (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:24:29339)
at e.t.notifyNestedSubs (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:24:28919)
at e.t.handleChangeWrapper (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:24:28987)
at m (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:36:1221822)
at https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:36:1212670
at Object.registerError (https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:124:164951)
at https://lib.openlaw.io/assets/build/js/TemplateEditor-1e9fc00….bundle.js:124:154386
sentry.admin.dev.ope…b9c8c4df2e6c8bb1e:1 Failed to load resource: the server responded with a status of 400 ()

that's strange, I've just tried it (you can look at the template DEAL-ENTITY DAVID TEST and it renders normally.

Oh I think I know the issue. it's when you save a new template the url rewrite is wrong (it has been fixed, waiting for a release)

let me know if you have any issue opening the deal I've created

Yes, I think this is probably tied to that naming bug then ... I did see issues with naming the template; check out the version history of deal-entity.

Ok, I was able to replicate the issue where it starts pointing to the main OL instance.
I hit refresh when the page was viewing the entity-deal, which wasn't loading properly (with the same issues as described in the stack trace in previous comment).
It points me to https://lib.openlaw.io/template/deal-entity

Your DAVID TEST did work for me at first...
I caused the same issue in your DAVID TEST by putting the two templates into one of the conditional clauses right above it. (But probably it's just from trying to re-save it and having the bug that you mentioned)
{{
{{Registered Agent = "I am open to hiring a Registered Agent through Etherize" =>
[[Agent Agreement]]
}}
{{Entity Formation = "I am open to hiring Etherize to form the Legal Component" =>
[[Agent Agreement: Template("information-entity")]]
[[Organizer Agreement: Template("service-agreement-organizer")]]
}}
}}

this should be fixed. I will close it but I will let you open it again it the issue remains