notea-org / notea

📒 Self hosted note taking app stored on S3
2.07k stars 377 forks source link

Next.JS client side exception #158

Closed jenga201 closed 1 year ago

jenga201 commented 1 year ago

I've had a notea/minio installation for about a year now. This error started showing up after the latest update.

image

There are no errors in the logs for either notea or minio. This seems to be a JS error only.

Is it possible that the /tree JSON can become corrupt with orphaned records to cause an undefined object member error?

tecc commented 1 year ago

Interesting. I will say that it is entirely reasonable that the tree can be corrupted. If it isn't an issue, could you send the response from /tree?

I'd say your guess is probably correct. I'll make a branch with a small change that should eliminate all undefined values.

jenga201 commented 1 year ago

I actually see some error JS generated right after the call to tree is made

image

Here's the tree file pulled from minio (renamed to .txt to support github upload). I'm not sure if it matters, but I'm unable to get it directly from notea.

tree.txt

tecc commented 1 year ago

Quick update: I forgot to push the new branch earlier, so I did it now and created a draft for a PR: #158. Could you tell me if the version changes anything for you?

Also, it is weird that you're unable to just call /api/tree and get the tree like so.

jenga201 commented 1 year ago

I'm running this on unraid using the image in docker hub, so I'm not sure I can build this PR locally. Is it possible for you to upload a new tag to docker hub?

Also, yes.. using /api/tree works fine. I was trying /tree initially.

tecc commented 1 year ago

I uploaded a build as teccthedev/notea:pr-160, which you should be able to use. Please tell me if it fixes the problem. Also, sorry for the delay.

jenga201 commented 1 year ago

The new PR worked wonderfully.

The initial page load showed the same error, then a page refresh seemed to clean everything up.

I'm not sure if it's expected, but going back to the main branch shows the error again. I'm guessing the tree isn't saved after it's loaded & modified.

tecc commented 1 year ago

No, the tree isn't saved. The fix only applies to when the tree is requested by the client. I'm mildly scared to apply the fix to the saving system as well since that could potentially lose data (if there's a bug), but hey. Anyways, I'll go ahead and merge the change since it clearly works.