Skip to content

Conversation

@elpoelma
Copy link
Contributor

@elpoelma elpoelma commented Jun 17, 2024

Overview

This PR includes some changes in how the equals method/property is defined on RDF term instances.
It defines equals as a prototype method on RDF term instances instead of as arrow functions.
This has two implications:

  • The equals function is no longer defined on RDF term instances themselves, but rather on their prototype.
  • Comparison functions (such as the one used by prosemirror-devtools) no longer fail due to them not supporting function properties.
  • Spreading an RDF term results in losing the equals method.
connected issues and PRs:

None

How to test/reproduce

  • Open up the dummy app
  • Insert a sample document containing RDFa
  • Ensure that functions are not supported error message no longer shows up.
  • There should be no issues with missing/undefined equals properties.

Challenges/uncertainties

The change/rollback included in this PR does have some (possibly unwanted) side-effects:

  • As mentioned before , applying the spread operator on an RDF term instances results in losing the equals method. Typescript tries to handle this in the best way possible, but may sometimes make mistakes. An example can be found on Typescript playground

Other possible approaches:

  • Using simple data objects to represent the RDF terms and using separately defined equals functions. This does have the drawback that we cannot leverage the RDFJS interfaces.
  • Ensuring that the comparison library used by the prosemirror devtools adds support for function properties. This can be a long-term solution which is possibly the best approach, as it may occur in other situations that prosemirror node-attributes contain arrow function properties. See Ignore functions instead of throwing error? benjamine/jsondiffpatch#284 for more info

Checks PR readiness

  • UI: works on smaller screen sizes
  • UI: feedback for any loading/error states
  • Check cancel/go-back flows
  • Check database state correct when deleting/updating (especially regarding relationships)
  • changelog
  • npm lint
  • no new deprecations

@elpoelma elpoelma added the bug Something isn't working label Jun 17, 2024
@elpoelma elpoelma self-assigned this Jun 17, 2024
Copy link
Contributor

@lagartoverde lagartoverde left a comment

Choose a reason for hiding this comment

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

Looks good, maybe you should wait for another review that knows about the implications of this change (cough cough Arne) :)

@elpoelma elpoelma force-pushed the fix/terms-equals-method branch from cfc9f4c to adbc615 Compare July 25, 2024 09:12
@piemonkey piemonkey force-pushed the fix/terms-equals-method branch from adbc615 to af19229 Compare May 28, 2025 15:01
Copy link
Contributor

@piemonkey piemonkey left a comment

Choose a reason for hiding this comment

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

I made use of this when debugging drag-drop stuff as otherwise the error messages were prohibitive. I didn't find any problems with it.

I pushed my rebased version to bring this up to date with master. I think it's worth merging and keeping an eye out for any issues we missed.

@elpoelma elpoelma force-pushed the master branch 3 times, most recently from 09a205a to e9b510d Compare October 17, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants