question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Programmatically triggered changes are not being normalized

See original GitHub issue

Using Slate 0.42.2, if you trigger changes programmatically, you need to call normalize() yourself.

See the bug in action here:

https://jsfiddle.net/gersomvg/fj9dvhom/2451/

I would expect normalization to take place without invoking manually, since the docs state:

The vast majority of changes, whether by the user or invoked programmatically, will run normalize by default to ensure the document is always in adherence to its schema.

I can try to PR this myself, after this is confirmed by someone else as a bug.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gersomvgcommented, Oct 24, 2018

I’ve found a related bug.

If you do this:

change.insertNodeByKey(document.key, 1, {
    object: 'block',
    type: 'divider',
});

Then normalizeNode is only invoked once for the divider node and not for the document as a whole.

This can be solved again by calling normalize manually:

change.insertNodeByKey(...).normalize()

Before I also had trouble with normalizing insertBlocks using a regular schema, so I don’t think it’s a problem with only marks @ianstormtaylor 😦

0reactions
ianstormtaylorcommented, Oct 24, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML JavaScript onChange Handler is not called when ...
The onchange event is not triggered by a programmatic change of the value of the textinput. You have to call the code you...
Read more >
Normalization Data Services
The Normalization Data Services plugin helps maintain consistency for table fields that refer to a company name.
Read more >
Changing Directive Inputs Programmatically Won't Trigger ...
So, I hit this issue as well. I was passing a new array into a component but that component's onChanges() lifecycle was not...
Read more >
Maybe Normalizing Isn't Normal - Coding Horror
Dare Obasanjo had an excellent post When Not to Normalize your SQL ... The thought being that the database, being as well designed...
Read more >
ALTER DATABASE (Transact-SQL) Compatibility Level
Sets Transact-SQL and query processing behaviors to be compatible ... Examples of breaking changes not protected by compatibility level are:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found