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

Sidebar title and doc title don't change after updating it in file. #813

Closed
KoenCa opened this issue Jun 29, 2018 · 25 comments
Closed

Sidebar title and doc title don't change after updating it in file. #813

KoenCa opened this issue Jun 29, 2018 · 25 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@KoenCa
Copy link

KoenCa commented Jun 29, 2018

Is this a bug report?

Yes

Have you read the Contributing Guidelines on issues?

Yes

Environment

Docusaurus v1.3.0
NPM v6.1.0
Node v8.11.3
Macbook Pro with MacOs High Sierra

Steps to Reproduce

Tried to reproduce it in a fresh Docusaurus project, but can't reproduce it there. What I can say about my own project is that it already has a lot of markdown files. I also have all of them in subdirectories inside the docs folder, so I also refer to them via their relative path in my sidebars.json file.

  1. Have the dev server running
  2. Have an existing docs file with its relative path in sidebars.json
  3. Change the title of the doc file
  4. Restart dev server

When building the project it also updates fine.

Expected Behavior

I expected the title to change to the new one in the sidebar and in the h1 header. This does not happen.

Actual Behavior

Title in sidebar doesn't change and the h1 header doesn't change, which used to work before, but sudddenly stopped working.

Sometimes I see this error in the console:

uhoh. Got error write EPIPE

But most of the time it doesn't show up.

I also asked this in the Discord channel and got a workaround:

  • Remove the i18n folder
  • Run npm run write-translations
  • Start dev server
  • Everything updates like normal

Reproducible Demo

Could not reproduce it in a fresh docusaurus project and can't share my own project here. If more details are needed I can provide them.

@endiliey
Copy link
Contributor

@KoenCa

  1. is it specific only to certain docs or any docs won't trigger the change of title ?
  2. Did you try to rm -rf node_modules and reinstall ? Clearing the babel cache as well
  3. Do you use versioning and/or translation ?

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

@endiliey

  1. I tried several different docs, none worked.
  2. I tried removing node_modules several times, also cloning my project again from GitHub. Only thing that works is removing that en.json file and running write-translations again. When I look in this file it is also incorrect.
  3. At the moment I don't use versioning or translation. But versioning will be added when first version of docs is ready.

Maybe it has something to do with the fact that I use subdirectories for my doc files? I also don't addy any id's to my doc files. I tried adding Id's but then docusaurus could not find the file by id.

@endiliey
Copy link
Contributor

endiliey commented Jun 29, 2018

@KoenCa

That's weird. My website use id on docs & warriorjs use subdirectories for all their docs with id too. You can check how warriorjs use subdirectories https://github.com/olistic/warriorjs/blob/master/website/sidebars.json

If your docs is in docs/projectA/test.md with id test then it should be referred as projectA/test in sidebars.json

Can you try adding id and see if it works ?

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

@endiliey

  1. Added id to a doc file
  2. Changed relative path in sidebars.json accordingly
  3. Restart sever and navigating to page still works
  4. Change title
  5. Restart server and again no change

Adding an id doesn't work.

I seem to get this error quite often now while change title attritube or others:

... Uhoh. Got error write EPIPE ...
Error: write EPIPE
    at _errnoException (util.js:992:11)
    at WriteWrap.afterWrite (net.js:864:14)

But it doesn't crash my development server and live reloading of text on pages still works.

@endiliey
Copy link
Contributor

endiliey commented Jun 29, 2018

@KoenCa

Can you try to remove i18n folder -> npm run write-translations -> change some docs title -> npm run write-translations again and see if the title is changed in i18n/en.json

Do not run dev server

Since the workaround is related with deleting i18n I think it got to do with write translation

@JoelMarcey
Copy link
Contributor

Deleting your current en.json should work and then do the right thing since you are on 1.3.0 -- although you can upgrade to 1.3.1 now too.

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

@endiliey

Just tried it, it does change the en.json correctly when I follow your steps. Maybe it doesn't work properly when the dev server is running?

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

@JoelMarcey

I don't see any 1.3.1 release yet?

@JoelMarcey
Copy link
Contributor

🤣 I got ahead of myself. I thought it went out last night. Should be today.

@endiliey
Copy link
Contributor

@KoenCa

so the workaround step has been reduced to

  1. Run npm run write-translations
  2. Start dev server

Does Everything updates like normal ?

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

@endiliey

Yes, it is not necessary to remove the en.json file. Everything updates like normal without removing it.

BTW, maybe I should add that I first started with v1.2.0, then upgraded to v1.2.1 and then upgraded to v1.3.0.

@endiliey
Copy link
Contributor

@KoenCa

So if you only start dev server without running npm run translation, the title won't change ?

If yes, I think the problem is that dev server doesnt run write-translations when it should have

https://github.com/facebook/Docusaurus/blob/e9eef3976025c9f428baec725e6daf929384b5fb/lib/server/server.js#L9
https://github.com/facebook/Docusaurus/blob/e9eef3976025c9f428baec725e6daf929384b5fb/lib/server/server.js#L156

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

@endiliey

Yes, changing title and only starting dev server won't change it. When running npm run write-translation it does change.

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

@endiliey

Or this function goes wrong?
https://github.com/facebook/Docusaurus/blob/e9eef3976025c9f428baec725e6daf929384b5fb/lib/write-translations.js#L33

And thats why I sometimes get this error?

... Uhoh. Got error write EPIPE ...
Error: write EPIPE
    at _errnoException (util.js:992:11)
    at WriteWrap.afterWrite (net.js:864:14)

@endiliey
Copy link
Contributor

endiliey commented Jun 29, 2018

@KoenCa

Seems so to me. This works for me but I think it didn't work for yours

test

Can you try above step & let me know abt the logs that appears ?

@endiliey endiliey added the bug An error in the Docusaurus core causing instability or issues with its execution label Jun 29, 2018
@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

In the docusaurus project or my own?

@endiliey
Copy link
Contributor

@KoenCa yours

Just for context how many markdown files do you have 😂

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

I just get logs like this:

> @ start /Users/koen/Documents/github/dovetail-docs/website
> docusaurus-start

Docusaurus server started on port 3000
LiveReload server started on port 35729

The error log mostly happens when the server is already running.

I have 78 markdown files at the moment and more will come. I also have 48 PNG images in my docs assets.

@endiliey
Copy link
Contributor

Tbh, it's a little bit hard for us to fix without reproducible demo

How about this. We'll release 1.3.1 soon. Let's see if that solve your problem later. Otherwise I might need you to give me a reproducible repo, maybe you can omit the docs content if it's confidential. Sorry for the trouble

@KoenCa
Copy link
Author

KoenCa commented Jun 29, 2018

No problem, I understand.

@endiliey
Copy link
Contributor

@KoenCa
In the meantime, you can use this solution. Edit your package.json

"start": "docusaurus-write-translations && docusaurus-start",

Let me know if it works 😊

@KoenCa
Copy link
Author

KoenCa commented Jul 2, 2018

@endiliey

Yes, it works 👍

@endiliey
Copy link
Contributor

@KoenCa I wonder if you still have the problem ? Couldn't find any similar report so I'll be closing this.

Ping me on Discord if needed

@sriniva7
Copy link

image

Still, title issue comes for us. Why that?
tried Deleting en.json file and tried changing package.json.
Kindly help

@Alfriend-xing
Copy link

Alfriend-xing commented Jun 20, 2020

i meet this situation too , i use v1.14.4

1

my solution

  • remove all files from this folder
  • use code editor create new files with same name one by one
  • copy content from old to new
  • restart dev server

2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

No branches or pull requests

5 participants