Skip to content
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

Applab: fix screen import ID conflict between screen and element #58667

Merged
merged 6 commits into from
May 22, 2024

Conversation

bencodeorg
Copy link
Contributor

@bencodeorg bencodeorg commented May 16, 2024

Applab has a feature that allows you to import "screens" from other projects:

image image

When using this feature, we have code that:

  • handles a conflict between two projects with screens with the same IDs, and
  • handles conflicts between two projects with individual elements (eg, buttons) with the same IDs.

A recent curriculum update (more detail here) exposed the fact that we don't handle two other sets of potential conflicts:

Conflict between... Current project Imported screen Result
screen ID element ID error, dialog hangs
element ID screen ID Import "succeeds", silently wipes element with name conflict from existing project

The change here is to treat these conflicts the same way that we treat conflicts between individual elements (eg, a button in the existing project matches a button in the screen to import). I include a slight rewording of the error message to support these cases.

Updated experience
Conflicts between screen IDs and element IDs appear in list of IDs preventing import. In this case, the project trying to do the import has a button with the ID screen1, and the screen to import has the ID screen1

image

Links

Testing story

I tested manually:

  • Each of the "cross-type" collision types (ie, screen ID-element ID collisions) blocks import gracefully per the screenshot above.
  • Screen ID-screen ID collision still offers the user the opportunity to overwrite their existing screen.
  • Element ID-element ID collision continues to blocks import of a screen.
  • Screen imports without any of these collisions succeed.

@bencodeorg bencodeorg requested a review from a team May 21, 2024 16:18
Copy link
Member

@breville breville left a comment

Choose a reason for hiding this comment

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

Excellent write-up and clarity around the entire test matrix.

Copy link
Contributor

@fisher-alice fisher-alice left a comment

Choose a reason for hiding this comment

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

Nice and +1 on well-written description! Just left a couple nits. Thanks!

apps/src/applab/import.js Outdated Show resolved Hide resolved
Cannot import the following screens because they contain
design elements with IDs already used in your existing
Cannot import the following screens because their IDs or
contained design element IDs are already used in your existing
project. Fix the IDs in either project so they aren't
duplicated across different screens before trying to import
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not your change, but wondering if the wording could be updated.
'Fix the IDs in either project so that they aren't duplicated between the two projects before trying to import.'
We already ensure that element/screen IDs are not duplicated across screens within the same project.
@dancodedotorg - lmk what you think. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Took me a sec to follow so just to clarify, I think the specific proposed diff is:

"Fix the IDs in either project so they aren't duplicated across different screens between the two projects before trying to import"

This change makes sense to me though, updated! I think we can make an executive decision here unless Dan objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

I trust y'all - don't wait up on me

apps/src/applab/import.js Outdated Show resolved Hide resolved
Copy link
Contributor

@sanchitmalhotra126 sanchitmalhotra126 left a comment

Choose a reason for hiding this comment

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

Nice sleuthing!

apps/test/unit/applab/ImportScreensDialogTest.js Outdated Show resolved Hide resolved
@bencodeorg bencodeorg merged commit bfbc037 into staging May 22, 2024
2 checks passed
@bencodeorg bencodeorg deleted the ben/fix-screen-element-import-bug branch May 22, 2024 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants