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

fix: Fix error that occurs when dragging a type into an object #13762

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

TomasEng
Copy link
Contributor

@TomasEng TomasEng commented Oct 10, 2024

Description

This pull request fixes an error that occurs when dragging a type into an object in our data modelling tool. This happened because the useAddRreference hook referenced the target parent with uniquePointer instead of schemaPointer. This pull request corrects that, in additon to add measures to prevent it from happening again. Here is a list of the changes:

  • Corrected the test data for useAddReference
  • Fixed the useAddReference hook
  • Made the getUniquePointer and removeUniquePointerPrefix methods on the SchemaModel class static, since they don't depend on this
  • Added an end-to-end test for this scenario and improved some Playwright selectors

How to reproduce the error in production

  1. Open a data model in studio
  2. Create a type and an object
  3. Drag the type into the object
  4. Observe that no reference to the type is added and that an error message appears in the console
Spiller.inn.2024-10-10.133616.mp4

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

@github-actions github-actions bot added area/data-modeling Area: Related to data models - e.g. create, edit, use data models. solution/studio/designer Issues related to the Altinn Studio Designer solution. quality/testing Tests that are missing, needs to be created or could be improved. frontend labels Oct 10, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.57%. Comparing base (eeaeece) to head (f49b0ca).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13762   +/-   ##
=======================================
  Coverage   94.57%   94.57%           
=======================================
  Files        1623     1623           
  Lines       21797    21800    +3     
  Branches     2570     2570           
=======================================
+ Hits        20615    20618    +3     
  Misses        939      939           
  Partials      243      243           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TomasEng TomasEng changed the title Fix error that occurs when dragging a type into an object fix: Fix error that occurs when dragging a type into an object Oct 10, 2024
@TomasEng TomasEng added added-to-sprint kind/bug Used when there is a defect / something is not working as it should. labels Oct 10, 2024
@TomasEng TomasEng marked this pull request as ready for review October 10, 2024 11:50
@TomasEng TomasEng added the skip-documentation Issues where updating documentation is not relevant label Oct 10, 2024
Copy link
Contributor

@Konrad-Simso Konrad-Simso left a comment

Choose a reason for hiding this comment

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

Nice work 💯

Copy link
Contributor

@ErlingHauan ErlingHauan left a comment

Choose a reason for hiding this comment

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

Fungerer som det skal i test. Bra fiks!

@ErlingHauan ErlingHauan merged commit f9c59ef into main Oct 11, 2024
10 checks passed
@ErlingHauan ErlingHauan deleted the fix/dragging-type-into-object branch October 11, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added-to-sprint area/data-modeling Area: Related to data models - e.g. create, edit, use data models. frontend kind/bug Used when there is a defect / something is not working as it should. quality/testing Tests that are missing, needs to be created or could be improved. skip-documentation Issues where updating documentation is not relevant solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-domain1
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants