Skip to content

Checks and fixes for pasting copied reference fields#103

Open
Logyrac wants to merge 1 commit into
mackysoft:mainfrom
Logyrac:f_copy_paste_fixes
Open

Checks and fixes for pasting copied reference fields#103
Logyrac wants to merge 1 commit into
mackysoft:mainfrom
Logyrac:f_copy_paste_fixes

Conversation

@Logyrac

@Logyrac Logyrac commented Jul 13, 2026

Copy link
Copy Markdown

Description

When copying and pasting values from a property's context menu, there were currently no checks in place to avoid certain issues:

  • Attempting to paste to a property who's current value is null causes an error due to JsonUtility.FromJsonOverwrite
  • Pasting a value from one type into a field of a different type, which may or may not have the appropriate fields

Added logic to check for potential conflicts and handle them.

Changes made

  • Store the copied field type in SessionState for use in type safety comparisons
  • Test for potential conflicts and return result as enum for handling
  • Implement menu items for different results:
    • When no issues are detected or copied value is empty continue as before, with no change
    • When copied value is different type than current value, but still valid for the property, then pasting will create a new instance via Activator and then merge the JSON in. The Paste menu item shows a warning that the type will be overwritten.
    • When current value is null, create a new instance using Activator before using JSON overwrite to avoid error.
    • When copied value type is not valid for the field (uses TypeCandiateService [which is mis-spelled as a note, should be Candidate]) then disable the menu item with message explaining incompatible type.
    • When copied value refers to an invalid of non-existent type (type may be deleted between copy and paste) add disabled item with text stating invalid type
  • Exposed function for evaluating qualification from TypeCandiateService, which evaluates the intrinsicTypePolicy and typeCompatibilityPolicy, for use in testing field combability in pasting, so that the TypeCandiateService is a single point of truth on this test.

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.

1 participant