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

Looking for a new feature branch for exporting! #3

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

pranitsh
Copy link
Collaborator

@pranitsh pranitsh commented Feb 18, 2024

A lot of the changes I wish to make regard the database, so I'm looking for a new branch (probably not the main branch, except for some of the earlier commits) to test my features and get some more guidance on what works and what I should change. This is my first pull request, so I'm more looking for your thoughts rather than merging at the moment, especially for how this approach looks.

@pranitsh pranitsh changed the title Looking for new feature branch! Looking for a new feature branch for exporting! Feb 18, 2024
@pranitsh pranitsh self-assigned this Feb 18, 2024
@pranitsh pranitsh added the help wanted Extra attention is needed label Feb 18, 2024
@pranitsh pranitsh linked an issue Feb 18, 2024 that may be closed by this pull request
cy.get('.ce-paragraph').eq(3).type("4{enter}");
cy.get('.ce-paragraph').eq(4).type("5");
cy.get('.ce-header').click().type("Title{enter}");
cy.get('.ce-paragraph').type("1{enter}2{enter}3{enter}4{enter}5");
Copy link
Owner

Choose a reason for hiding this comment

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

Okay, it makes sense and is more concise, but it requires an assertion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Which assertion do you suggest?

return doc._data
})
if (doc._data) {
const propertiesToDelete = [
Copy link
Owner

Choose a reason for hiding this comment

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

The variable should be declared outside of the loops.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, any suggested places for this constant?

src/app/notebook/shell/shell.ts Show resolved Hide resolved
@@ -385,12 +370,10 @@ export class Shell {
this.editor.blocks.update(block.id, block.data);
}

Copy link
Owner

Choose a reason for hiding this comment

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

Why did you change this to async if you don't require await?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, kinda struggling to figure out what this is referencing. Could you please clarify which async?

const blocks = JSON.parse(await input.files[0].text()).blocks;
await this.manager.bulkInsertBlocks(blocks);
const currentBlocks = (await this.manager.exportNotebook(url.read("p"), url.read("t"))).blocks;
let currentMaxndex = currentBlocks.reduce((max, _, index) => Math.max(max, index), 0);
Copy link
Owner

Choose a reason for hiding this comment

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

It is unnecessary because you can use:
currentMaxIndex = currentBlocks.lenght-1;
Blocks have their own index because they are stored randomly in the database, but they are presented in order to the user. So, if you want to store new blocks after the current ones, you only need the number of blocks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's hard exactly to remember what the rationale behind this was, but I believe somehow the numbers didn't match, and I wanted to use something different and was experimenting with getting the correct numbers for the place to insert. Seems I will have to change my approach either way.

currentMaxndex += 1;
}
return block;
}).filter((block: BlockDocument | undefined) => block !== undefined).forEach;
Copy link
Owner

Choose a reason for hiding this comment

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

Why did you do with the forEach?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, some of this is just me getting my thoughts together. Seems I missed that!

const data = await this._database?.exportJSON();
let toExport: Array<BlockDocument> = [];
data?.collections[1].docs.forEach((element) => {
if (element.createdBy === peer) {
if (element.createdBy === peer && element.topic === topic) {
Copy link
Owner

Choose a reason for hiding this comment

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

The topic is an identifier for a set of blocks intended to represent a notebook, so it should be

if (element.topic === topic)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the clarification!

@sanchezcarlosjr
Copy link
Owner

I've provided you with the develop branch. Please use it. Additionally, every time you make a pull request, Firebase creates a preview website to showcase your progress. https://github.com/sanchezcarlosjr/evanotebook/blob/main/.github/workflows/firebase-hosting-pull-request.yml

@pranitsh
Copy link
Collaborator Author

Thank you for reviewing my pull request! I appreciate the feedback!

@pranitsh
Copy link
Collaborator Author

pranitsh commented Feb 19, 2024

I've provided you with the develop branch. Please use it. Additionally, every time you make a pull request, Firebase creates a preview website to showcase your progress. https://github.com/sanchezcarlosjr/evanotebook/blob/main/.github/workflows/firebase-hosting-pull-request.yml

Oh, I didn't know, following the GitHub workflow is a bit difficult, and I kind of don't know how Firebase hosting works, since I haven't needed such a service before. I'll look into it a bit in the future, though could you clarify where this website link is if possible? I'll also use the new develop branch for the future.

@pranitsh
Copy link
Collaborator Author

pranitsh commented Feb 19, 2024

Oh, found it: https://github.com/sanchezcarlosjr/evanotebook/actions/runs/7946059563
Yep, I rather work with the develop branch and perform PRs through that, so to still allow PRs, can we remove that workflow?

I believe I heard PRs can still allow commits. You should see new commits with some of the comments resolved by Wednesday (after some hw is due), though I would really appreciate addressing this after this discussion.

All changes follow the current license you have.

Thanks again for providing me with feedback. This is essentially my first pull request and I'm very appreciative of you taking the time to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Questions!
2 participants