Closed rhuss closed 7 years ago
Maybe this error is also related:
The validation errors shown in the second screen shot is not related. We have a validation service that's currently in progress. That validation service is return two errors (when it should show one) for that error right now.
@gashcrumb fyi. Looks like the Syndesis UI is creating dupe sources and targets in new integrations.
@jbakermd have a PR open where I've verified (just via some console logging) that the host component is only passing one instance of a source/target -> https://github.com/syndesisio/syndesis-ui/pull/686
I think the problem could be that the syndesis-ui treats the data mapper component as disposable, i.e. you navigate away from the page and the UI gets destroyed, however I think the underlying data mapper services are still effectively in-memory. So when you go back into the data mapper the previous state is there, and new state is added as well.
It might just be a matter of dealing with re-initialization of the data mapper's angular services when the user goes back into the data mapper view. Or maybe a 'destroy()' method I can call from the host component's ngOnDestroy()
Also take a look at this newly created duplicate issue -> https://github.com/syndesisio/syndesis-ui/issues/680 I linked, has good steps to reproduce.
Ah that explains it completely. I was under the impression the data mapper was created and destroyed every time the user clicked that part of the integration screen. Given the interesting hoops I had to jump through to dynamically include/destroy components within the modal component, I would highly recommend not trying to mess with dynamically recreating the data mapper component, but instead add a way to reset the config to zero before initialization happening again.
Something like a configModel.reset() method. That method would need to:
@gashcrumb thanks a lot for narrowing this down.
@jbakermd np! Yeah, a configModel.reset()
function would be perfect, then I can call that before re-initializing. And yeah, to clarify all the UI components do get destroyed, but thanks to angular all the services that the UI uses to do it's thing are singletons, and they hang around.
We probably would have spotted this sooner if we had some more example integrations with different types, as going from one integration to a different one with different types would have exposed this issue right away. But, it is what it is :-) Thanks!
Ah, that's it. Its that the services are hanging around. This is a new bug since summit then because I changed the config model's parent to the initializationservice. Before this change, a host component would create a totally new config model, set it on all of the services and we'd be golden. After the change, there's just one config sitting around and its magically set on all of the services by the initservice's constructor for simplicity. The reset() method is definitely needed on config model now.
Ok, there are going to be two PRs here, one for the data mapper side, and one for the syndesis side.
Data mapper side is merged, that's PR: https://github.com/atlasmap/atlasmap-ui/pull/65
Syndesis side PR: https://github.com/syndesisio/syndesis-ui/pull/699
@gashcrumb please review https://github.com/syndesisio/syndesis-ui/pull/699 (or have someone else review it).
This is fixed.
When creating a Twitter to Salesforce integration (with the latest atlasmap fixes applied), the UI seems to add duplicated objects randomly (see screenshot):
Also, tons on error message occur in the console: