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

Link comments to scenes based on the commentId prop #4795

Merged
merged 5 commits into from
Jan 30, 2024

Conversation

bkrmendy
Copy link
Contributor

@bkrmendy bkrmendy commented Jan 25, 2024

Problem

The relationship between the id prop on Scenes and the position of Scene comments is not evident. If a user deletes the id prop from a scene, any comments attached to that scene would be reparented to the canvas, without any indication from us.

Fix

Link the comments on scenes based on the value of the commentId prop, which better communicates the purpose of the prop

@@ -11,10 +11,10 @@ import * as PP from '../shared/property-path'
import { assertNever } from '../shared/utils'
import { isSceneAgainstImports, isRemixSceneAgainstImports } from './project-file-utils'

const IdPropName = 'id'
export const SceneCommentIdPropName = 'data-comment-id'
Copy link
Member

Choose a reason for hiding this comment

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

Since it's ONLY for scenes, could we make this just commentId? Scene is our component, so we we can make it a bit less clunky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I updated it in 7ebe371.

The reason I went with data-comment-id is because it fit the mold of the other Utopia-specific props on Scene (data-label, data-uid), and using data-comment-id didn't make it necessary to tweak the code of Scene (without the tweaking, a React error is triggered: React does not recognize the 'commentId' prop on a DOM element, since all props on Scene are forwarded to the underlying div).

Copy link
Contributor

github-actions bot commented Jan 25, 2024

Try me

Copy link

relativeci bot commented Jan 25, 2024

Job #10095: Bundle Size — 59.83MiB (+0.01%).

f163efd(current) vs f73aa2d master#10094(baseline)

Warning

Bundle contains 66 duplicate packages – View duplicate packages

Bundle metrics  Change 5 changes Regression 3 regressions
                 Current
Job #10095
     Baseline
Job #10094
Regression  Initial JS 45.65MiB(+0.02%) 45.64MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 23.98% 23.56%
No change  Chunks 27 27
No change  Assets 31 31
Change  Modules 4503(+0.02%) 4502
Regression  Duplicate Modules 583(+0.17%) 582
Regression  Duplicate Code 27.55%(+0.04%) 27.54%
No change  Packages 462 462
No change  Duplicate Packages 65 65
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
Job #10095
     Baseline
Job #10094
Regression  JS 59.82MiB (+0.01%) 59.81MiB
Improvement  HTML 11.83KiB (-0.32%) 11.87KiB

View job #10095 reportView feature/scene-comment-id-rename branch activityView project dashboard

@bkrmendy bkrmendy changed the title data-comment-id Link comments to scenes based on the commentId prop Jan 25, 2024
@@ -11,10 +11,10 @@ import * as PP from '../shared/property-path'
import { assertNever } from '../shared/utils'
import { isSceneAgainstImports, isRemixSceneAgainstImports } from './project-file-utils'

const IdPropName = 'id'
export const SceneCommentIdPropName = 'commentId'
Copy link
Contributor

Choose a reason for hiding this comment

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

small suggestion - maybe comment-target-id?
(since it's not the id of a comment, but the id of the scene as a comment target)

@@ -81,7 +81,11 @@ const BasicUtopiaSceneDescriptor = (
jsxElementWithoutUID(
name,
[
jsxAttributesEntry('id', jsExpressionValue('scene', emptyComments), emptyComments),
jsxAttributesEntry(
'commentId',
Copy link
Contributor

Choose a reason for hiding this comment

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

there isn't a way to use SceneCommentIdPropName here, right?

@@ -7831,7 +7831,7 @@ packages:
dev: true

/component-indexof/0.0.3:
resolution: {integrity: sha1-EdCRMSI5648yyPJa6csAL/6NPCQ=}
resolution: {integrity: sha512-puDQKvx/64HZXb4hBwIcvQLaLgux8o1CbWl39s41hrIIZDl1lJiD5jc22gj3RBeGK0ovxALDYpIbyjqDUUl0rw==}
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh?

@bkrmendy bkrmendy merged commit aa0a01d into master Jan 30, 2024
11 of 12 checks passed
@bkrmendy bkrmendy deleted the feature/scene-comment-id-rename branch January 30, 2024 11:36
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.

4 participants