Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Import filter canImport not working as expected #34

Closed
jheelbharambe opened this issue Jul 22, 2022 · 3 comments
Closed

Import filter canImport not working as expected #34

jheelbharambe opened this issue Jul 22, 2022 · 3 comments

Comments

@jheelbharambe
Copy link

Brief bug description

Import filter for canImport -> contentType is not working as expected.

What went wrong?
I want the contentTypes import to work for a given Content Type only. However, the import flow ignores all contentTypes completely.

Repro steps

  1. Select a zip of project containing multiple content types.
  2. Create a new import service with config:
    canImport: { contentType: item => { if (item.codename === 'codename_of_one_content_type_in_your_project') { // content type will be imported only if the codename is equal to 'n020_app_ui_string' return true } // all other types will be excluded from import return false }, ... }
  3. Try importing using Import Service with above config
  4. See that this importService skips all content types completely.

Expected behavior

The import service should import the content type specified in the config.

What the correct behavior is?

The import service should import the content type specified in the config.

Test environment

Tested this via GitHub actions by creating a custom action using typescript.

Additional context

Add any other context about the problem here.

Screenshots

Screenshot 2022-07-21 at 12 23 02

@Enngage
Copy link
Contributor

Enngage commented Jul 22, 2022

Hi,

In case of your config only a single content type with codename codename_of_one_content_type_in_your_project would be imported. All other types should be ignored which is expected behavior based on this configuration.

Can you expand on what you are trying to do?

@jheelbharambe
Copy link
Author

Hi,

In case of your config only a single content type with codename codename_of_one_content_type_in_your_project would be imported. All other types should be ignored which is expected behaviour based on this configuration.

This behaviour mentioned is exactly what I want. However, what is actually happening is content types are being skipped out completely. The content type with codename: codename_of_one_content_type_in_your_project is also being skipped for some reason even though the config returns true.

What I found while debugging was on line 293 of the screenshot in the issue, the contentTypes list is getting emptied out in the first loop(from line 290) itself. Probably because id field does not exist on m / item .

@Enngage
Copy link
Contributor

Enngage commented Jul 22, 2022

@jheelbharambe,

I see what is going on. The skip action was moved to section after translating ids and therefore the id property was no longer there. I've moved it back and it should be working well now :) It's been released in 4.0.1. Thanks for letting us know!

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

No branches or pull requests

2 participants