Skip to content

Conversation

LakshSingla
Copy link
Contributor

@LakshSingla LakshSingla commented Nov 17, 2018

Before your pull request is reviewed and merged, please ensure that:

  • there are no linting errors -- npm run lint
  • your code is in a uniquely-named feature branch and has been rebased on top of the latest master. If you're asked to make more changes, make sure you rebase onto master then too!
  • your pull request is descriptively named and links to an issue number

Fixes #765
#765
Todo

  • Return parent folder's ID in case if a user is logged in ( I think it would cause issues due to asynchronous nature of execution )
    I have added an empty placeholders.
    line#85
    line#196
    They are to be replaced by the ID of the newly created folder. ( As done in the case when user is not logged in ).
  • Filter out empty folder names caused due to split method called on successive delimiters
  • Add documenting comments to the function
    I would complete the last 2 points in a day or two.

@LakshSingla LakshSingla changed the title Allow nesting of files and folders using AddFile and AddFolder modal [WIP] Allow nesting of files and folders using AddFile and AddFolder modal Nov 18, 2018
@LakshSingla
Copy link
Contributor Author

@catarak Apparently, nodemon keeps disconnecting from my mongoDB database on making any changes, forcing a recompilation of webpack (on restarting the server). Is this issue observed anywhere else? I will attach the screenshot of the terminal later today.

@LakshSingla
Copy link
Contributor Author

@catarak I am unable to figure out how to resolve the issue if the user is logged in (where subsequent folder requests would need to be sent to the server)...

@catarak
Copy link
Member

catarak commented Nov 20, 2018

@LakshSingla maybe all of the file id's should be generated client-side? i'm not sure if that's the issue you're having.

@LakshSingla
Copy link
Contributor Author

@catarak So here's the deal.. If the user is logged in, the Folder Id is not created on the client side, rather a request is made to the server, which creates the file and sends the desired response. Thus to generate child folders/file, I would need to have the parent id of the folder which was newly created. How should I get that ?? (As requests are made asynchronously). TLDR: Help me fill the line#85 and line#196 and make sure that the parent id is updated before the request to create next file/folder is made

@catarak
Copy link
Member

catarak commented Nov 22, 2018

got it! well, maybe the folder id could be created client side, even if the user is not logged in?

@LakshSingla
Copy link
Contributor Author

LakshSingla commented Nov 22, 2018

@catarak The folder id is created on the client side when the user is not logged in. The problem arises when the user is logged in. It seems as if the API is creating some ID and passing it as a response to the client. Now I am concerned that as the call is asynchronous, what should I return as the folder id for the next folder creating function. It would help me greatly, if you could help me implement this logic.

@LakshSingla
Copy link
Contributor Author

@LakshSingla maybe all of the file id's should be generated client-side? i'm not sure if that's the issue you're having.

This is doable, if all of the file's and folder's ids are generated client side, but it would require changes from the backend code. I doubt if it would be feasible that much, as currently the id returned is the mongodb's internally created id. Would it be possible, if we extend this feature to those users who aren't logged in (although it would be a source of confusion). As and when this issue is resolved for those users who are logged in, we could extend the support to them.

@catarak
Copy link
Member

catarak commented Nov 26, 2018

maybe there's a bigger (and separate) issue here, which is that the data structure of the files/folders should be abstracted on the front end. #542 has some discussion about this, but it's interesting to see how this affects the application outside of the context of a public API.

for context, i used a mongodb tutorial (https://docs.mongodb.com/manual/tutorial/model-tree-structures-with-child-references/) as reference for how to structure the files.

@LakshSingla
Copy link
Contributor Author

@catarak Due to exams in university, I am unable to work on this. I will resume as soon as they get finished. I think that instead of changing the database code, we could serialize the requests made to the server.

@catarak
Copy link
Member

catarak commented Dec 6, 2018

@LakshSingla no worries! this is not an urgent issue and there is higher priority stuff i am focusing on at the moment.

@LakshSingla
Copy link
Contributor Author

LakshSingla commented Feb 4, 2019

@catarak I was trying to take up this issue once more. Can you please tell me when is the value of state.project.id true (or set to something) ? I have tried using it without logging in, logging in via Google and via local server and it shows undefined all the time. More importantly, when does this piece of code runs, because that case is not handled and I can't seem to find when it will run.
Thanks 😃

@catarak
Copy link
Member

catarak commented Feb 20, 2019

@LakshSingla the reason for that if statement is to check if a project is new and needs to be created, server-side, in which state.project.id would be undefined, or if the project already exists, in which state.project.id would be defined, and would then need to be updated server-side.

@catarak catarak closed this May 26, 2020
@catarak catarak reopened this May 26, 2020
@catarak catarak changed the base branch from master to develop August 26, 2020 17:01
@raclim
Copy link
Collaborator

raclim commented Feb 8, 2023

Closing due to this being stale. Please reopen or make another pull request if you'd like to make the updates! :)

@raclim raclim closed this Feb 8, 2023
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