-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Bugfix/set node #4143
Bugfix/set node #4143
Conversation
@@ -1,3 +1,4 @@ | |||
import { update } from 'lodash' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it looks like we aren't using update
yet in this code, maybe it's in code you haven't pushed yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't use it too 🤔
|
@timbuckley, can you please help me take a look at this? I'm not exactly sure what the problem is |
if you are talking about the failing test then the problem is in this file |
Thank you. But the file isn't part of this branch. |
@adisen based on @nivekithan 's comment, you might want to refer to this commit where the |
I understand. But I can't even find the file in the repo, so there's no way of fixing it |
@adisen it might have gotten removed in subsequent changes. If you pull the latest changes to |
@timbuckley @BrentFarese @princiya please take a look. Thanks |
@@ -67,7 +68,7 @@ export interface NodeTransforms { | |||
) => void | |||
setNodes: <T extends Node>( | |||
editor: Editor, | |||
props: Partial<Node>, | |||
props: Partial<T> | ((existingProps: NodeProps) => Partial<T>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to change the type of NodeProps
to be generic. Can you try the below and let me know if it works?
type NodeProps<T extends Node> = T extends Element ? Omit<T, 'children'> : Omit<T, 'text'>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change this in the interfaces/node.ts file right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wherever the type is defined change it there. Thx.
@@ -1,13 +1,11 @@ | |||
--- | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of diff in this PR that you probably did not change? Rebase off Main to get rid of the diff if you can. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try and make NodeProps
type generic. Also try and rebase off Main to get rid of diff/changes that you probably did not make in this PR. Otherwise, test and other changes look good! Thanks.
--- | ||
|
||
**Description** | ||
---**Description** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we did a rebase together off the main
branch. looks like the yarn fix
command broke this? @adisen and I will check again...
when the lint errors were fixed previously, it was based against the outdated MLH repository's master branch. reverting these files might most likely fix the unwanted diffs.
I'm closing this cause of the rebasing issues. And I have opened another PR that solves the problem and keeps everything clean |
Description
This PR allows Transforms.setNodes to take either a Partial as it second argument to props (which we have before) which overrides the props on the node or a function that takes the existing props for the relevant node and returns a new set of props to attach to the node.
Issue
Fixes: #3808
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)