Skip to content

useTracker renders two times at mount, would be nice if it renders only once #439

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

Open
Poyoman39 opened this issue Apr 14, 2025 · 5 comments · May be fixed by #440 or #436
Open

useTracker renders two times at mount, would be nice if it renders only once #439

Poyoman39 opened this issue Apr 14, 2025 · 5 comments · May be fixed by #440 or #436
Labels

Comments

@Poyoman39
Copy link
Contributor

This code renders two times

    const Test = ({ afterMountInc = false }) => {
      renderCount++;
      console.log(renderCount);
      value = useTracker(() => {
        return null;
      }, []);
      return <span>{renderCount}</span>;
    };

    ReactDOM.render(<Test />, container);
@Poyoman39
Copy link
Contributor Author

This PR #436 intends to fix this issue

@Poyoman39
Copy link
Contributor Author

This PR #440 intends to add a test for this issue

@nachocodoner
Copy link
Member

Is this related with useSubscribe as well as reported in the forums https://forums.meteor.com/t/usesubscribe-and-usetracker-fire-multiple-times-react-meteor-data/63448/4?

I wonder if latest fixes on master have fixed it, likely not yet. Last published version, meteor add [email protected]

@Poyoman39
Copy link
Contributor Author

Poyoman39 commented Apr 17, 2025

Not sure 🤔 I can write a test to confirm this if you want @nachocodoner

@nachocodoner
Copy link
Member

That'd be great @Poyoman39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants