-
Notifications
You must be signed in to change notification settings - Fork 20
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
In apos-global, joinByOne in an object is not resolved in Live mode. (underlying id not updated to point to Live ver when commit) #283
Labels
Comments
any updates :( |
I dug into the core and applied this patch, apparently does the trick: diff --git a/node_modules/apostrophe-workflow/lib/implementation.js b/node_modules/apostrophe-workflow/lib/implementation.js
index 22be6fc..1a6d573 100644
--- a/node_modules/apostrophe-workflow/lib/implementation.js
+++ b/node_modules/apostrophe-workflow/lib/implementation.js
@@ -348,6 +348,9 @@ module.exports = function(self, options) {
fromArrays = fromArrays.concat(self.findJoinsInSchema(doc, field.schema));
});
}
+ if (field.type === 'object' && typeof doc[field.name] === 'object') {
+ fromArrays = fromArrays.concat(self.findJoinsInSchema(doc[field.name], field.schema));
+ }
}
), function(field) {
return { doc: doc, field: field, value: doc[field.name] }; |
Thank you very much for this fix! We've been keeping your bug report in our
queue but had a lot of deadlines for enterprise customers this week, and
coincidentally we weren't sure why they hadn't mentioned the bug. The
answer of course is that they weren't using object fields in the same way
you are.
I'd like to send you some Apostrophe swag; if you'd like a T-shirt, please
drop me a line at [email protected] with your mailing address. Thanks!
…On Mon, Nov 18, 2019 at 4:14 AM Eric Wong ***@***.***> wrote:
I dug into the core and applied this patch, apparently does the trick:
diff --git a/node_modules/apostrophe-workflow/lib/implementation.js b/node_modules/apostrophe-workflow/lib/implementation.js
index 22be6fc..1a6d573 100644--- a/node_modules/apostrophe-workflow/lib/implementation.js+++ b/node_modules/apostrophe-workflow/lib/implementation.js@@ -348,6 +348,9 @@ module.exports = function(self, options) {
fromArrays = fromArrays.concat(self.findJoinsInSchema(doc, field.schema));
});
}+ if (field.type === 'object' && typeof doc[field.name] === 'object') {+ fromArrays = fromArrays.concat(self.findJoinsInSchema(doc[field.name], field.schema));+ }
}
), function(field) {
return { doc: doc, field: field, value: doc[field.name] };
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#283>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27KLD3BS6VPP5GITGALQUJMI7ANCNFSM4JI7SZHQ>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In
apostrophe-global
, when there is anobject
field containing ajoinByOne
field, the relationship is not resolved as expected when in Live mode, the field will be missing completely (and the ID field will retain draft version's ID).Steps to Reproduce
npm i
insidenpm install --save apostrophe-workflow
lib/modules/apostrophe-global/index.js
with the following content:lib/modules/apostrophe-pages/views/pages/home.html
, add<script>console.log({{ data.global|json }})</script>
for testing.demoField2Id
,_demoField2
,demoField.demoFieldInnerId
,demoField._demoFieldInner
are all present as expected:demoField2Id
,_demoField2
, anddemoField.demoFieldInnerId
are present, butdemoField._demoFieldInner
is not. Moreover, the ID indemoField.demoFieldInnerId
is still storing draft version's ID (maybe hinting the commit flow is forgetting to update this ID to point to the Live home page's ID):Notes
The field setup should be valid, this works perfectly fine before workflow module is installed.
The text was updated successfully, but these errors were encountered: