Giter VIP home page Giter VIP logo

Comments (10)

TrySound avatar TrySound commented on May 11, 2024 1

We already use data-rh by the way

from react-head.

tizmagik avatar tizmagik commented on May 11, 2024 1

This is now fixed with the latest v3.0.0 release. Please feel free to open a new issue if there's still any problems.

from react-head.

zhangciwu avatar zhangciwu commented on May 11, 2024

My workaround:

import {createElement} from 'react';
import {HeadTag, Meta} from 'react-head';

const HeadTagSsrOnly = HeadTag;

// remove all client refresh actions.
HeadTagSsrOnly.prototype.componentDidMount = () => {
  // nothing
};

HeadTagSsrOnly.prototype.componentWillUnmount = () => {
  // nothing
};

export { HeadTagSsrOnly};

Only for MPA without front-ending routing

from react-head.

TrySound avatar TrySound commented on May 11, 2024

@tizmagik Seems like there is something wrong with selector builder

from react-head.

tizmagik avatar tizmagik commented on May 11, 2024

Yea, this is the same issue as #16 -- I think we just need to escape the selector

from react-head.

zhangciwu avatar zhangciwu commented on May 11, 2024

Using content as query isn't quite smart( content can be various and very long)
Maybe react's key mechanism is a good solution
Require key when insert head tags and using it to manipulate dom then

from react-head.

tizmagik avatar tizmagik commented on May 11, 2024

We need some kind of deterministic key that we are aware of/control on both server and client side β€” open to suggestions!

Edit: Hm, actually maybe we only need to know that react-head places the tags, so maybe we don’t need such a deterministic key?

from react-head.

zhangciwu avatar zhangciwu commented on May 11, 2024

Seems buildSelector is used to remove SSR tags only,
Maybe just tagging SSR tags for all (like add a "ssr" attribute to the html)
And at client just remove all tags with that attribute

Need to select a name that will not be used by others, like "__ssr__" (kind of python style)

from react-head.

zhangciwu avatar zhangciwu commented on May 11, 2024

So just delete all document.querySelectorAll('head [data-rh]') to remove SSR tags?

from react-head.

tizmagik avatar tizmagik commented on May 11, 2024

I think so, that should work. Would you be able to submit a PR and try it out?

from react-head.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.