question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Context is broken with react-tree-walker

See original GitHub issue

Creating this issue so that we have one place to discuss potential solutions.

I recently added react-tree-walker to this package so that we can traverse React component trees to determine the exact namespaces required to render that tree correctly. This allows us to do SSR in the most efficient way possible.

However, it seems that there are several context-related issues with react-tree-walker:

  1. Context is poorly supported in general.
  2. Users are passing custom context, which will end up being missed by the shallow render inside the app-with-translation HOC.

Instead of going down this road, I would really prefer if we can come up with a different way to do tree traversal that does not depend upon context. All we need to do is traverse a tree, checking for props.ns. If props.ns exists, we need to add it to an array. That’s it.

Does anyone have any good ideas?

Otherwise, we’ll probably need to revert to sending down all namespaces to the client. This is not ideal, especially for (very) large apps.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:27 (25 by maintainers)

github_iconTop GitHub Comments

2reactions
revskill10commented, Dec 17, 2018

Thanks @isaachinman for this direction. I love this very much, as it’s very easy to integrate i18n to any existing Next.JS project without breaking anything. Because it’s just getInitialProps after all, no magic hidden for user to debug.

2reactions
isaachinmancommented, Dec 17, 2018

E.g. in dev-mode I’d like to always get notified if no namespacesRequired is detected and explain that all namespaces then get sent - the icing on the cake would be getting notified along with a link to an issue or a webpage explaining the whole thing in detail.

7f7fc63

Read more comments on GitHub >

github_iconTop Results From Across the Web

Context is broken with react-tree-walker · Issue #54 - GitHub
I recently added react-tree-walker to this package so that we can traverse React component trees to determine the exact namespaces required to ...
Read more >
Context not working properly in React-Native - Stack Overflow
In order to use contexts properly, you need to have at least two components working together,one that renders the Provider and one ...
Read more >
Fatih Küpelikilinc (@fatihkupkil) / Twitter
A monad is a way of composing functions that require context in addition to the ... (react-router) in #React before transitioning using react-tree-walker....
Read more >
next-i18next: Versions - Openbase
This might solve issues with duplicates and multiple i18n context instances. ... Remove broken Greenkeeper badge (a1b2322). Features:.
Read more >
Dependencies | olymp | npm - Open Source Insights
arrow_right apollo‑cache‑inmemory. 1.6.6 Notes Relation Licenses Dependencies Version 1.6.6 Published Description arrow_right apollo‑client. 2.6.10 Notes Relation Licenses Dependencies Version 2.6.10 Published Description
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found