Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

fix: remove components respect dependencies Close #16 #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix: remove components respect dependencies Close #16 #17

wants to merge 1 commit into from

Conversation

yugasun
Copy link

@yugasun yugasun commented Mar 31, 2020

No description provided.

@medikoo
Copy link

medikoo commented Apr 2, 2020

@yugasun great thanks for this PR.

Can you explain in more detail, why is that needed, and why the @serverless/core is replaced with @slsplus/core (?)

@yugasun
Copy link
Author

yugasun commented Apr 2, 2020

@medikoo Sorry for the mistake, change @slsplus/core to @servereless/core.

@medikoo
Copy link

medikoo commented Apr 3, 2020

Thank you @yugasun still can you explain in more detail why is that needed? (there's no description provided, and I don't understand intention behind this PR)

@yugasun
Copy link
Author

yugasun commented Apr 3, 2020

@medikoo Relative issue: #16

Copy link

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yugasun it's clearer now. Still I asked for some clarifications below. let me now

utils.js Outdated
@@ -326,7 +334,7 @@ const syncState = async (allComponents, instance) => {
await metric.publish()
}

promises.push(fn())
await fn()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'll be cleaner (and less confusing for one who may read this code later) to just remove the function wrap in such case, and remove further await Promise.all()

this.context.status('Removing')

this.context.debug('Flushing template state and removing all components.')
await syncState({}, this)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why syncState({}, this) is not enough to properly remove components?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because syncState() just remove all components at the same time, not analysis the dependency tree. For some relative components, should remove the relative component firstly, otherwise it will fail to remove.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because syncState() just remove all components at the same time,

But you've fixed that in that PR here: https://github.com/serverless/template/pull/17/files/bc2003dd824351b04cc40cb3ff9f3c1e436985c5#diff-14ef994fa167d355bdaf9b44add54b87R337

So my question is why is that fix not enough (?)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants