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

Unique ids in blocks with nanoid #1667

Merged
merged 12 commits into from
Apr 27, 2021
Merged

Unique ids in blocks with nanoid #1667

merged 12 commits into from
Apr 27, 2021

Conversation

jggc
Copy link
Contributor

@jggc jggc commented Apr 20, 2021

I tested manually a bit and it works nicely with some limitations (Yes the text is gibberish)
Screenshot from 2021-04-20 15-32-15

What works

  • Generates an id when a block is created
  • ID stays the same when block is updated or moved

What does not

  • ID changes when block type changes (paragraph -> header, header -> list for example)

Copy link
Member

@gohabereg gohabereg left a comment

Choose a reason for hiding this comment

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

Change log should be added

…id, add changelog and some documentation

Also improved some documentation along the lines and fixed linting
@jggc
Copy link
Contributor Author

jggc commented Apr 23, 2021

@gohabereg @neSpecc I'll be mostly unavailable to work on this PR for the next couple days, don't hesitate to push more improvements until it's mergeable.

If I see more review comments I'll try my best to make the fixes quickly still but I'll try to take the weekend off.

it('should preserve passed ids', () => {
const blocks = [
{
id: nanoid(),
Copy link
Member

Choose a reason for hiding this comment

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

We use nanoid (10). What should happen when user pass id not in an our format? We should show error or preserve them? I think, we need to add a test for that case.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so. User can use any format for ids on the backend side, even just numbers. We should just preserve everything user passes

Copy link
Member

Choose a reason for hiding this comment

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

That was a question.

@neSpecc neSpecc merged commit de36417 into codex-team:next Apr 27, 2021
@nowakkamil nowakkamil mentioned this pull request May 15, 2021
@neSpecc neSpecc mentioned this pull request Jul 20, 2021
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.

3 participants