useTracker problem - Can't set timers inside simulations
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend
Research direction
Reproduce the transition from a null to non-null contact, then inspect the useTracker.ts paths at lines 81 and 163 shown in the stack traces, including useTrackerClient and useTrackerDev. Done means the transition no longer raises "Can't set timers inside simulations" and the tracker can proceed through the reported subscription scenario.
Written by the indexing model from the issue text.
Description
I'm using useTracker like this:
<div>{!contact ? null : (
<AsyncValue
subscription={{
name: 'mail.contactStats',
args: [contact.ID],
query: () => MailStats.findOne({ _id: `for-contact-${contact.ID}` }),
}}
/>
)}</div
export function AsyncValue({ promise, subscription, render, children, onError }) {
const [error, setError] = useState(null);
const { name, args, query } = subscription;
const value = useTracker(
() => {
LOG('METEOR TRACKER?', subscription);
if (error) return undefined; // otherwise we get an infinite loop trying to resubscribe
// I COMMENTED MY WHOLE CODE TO NARROW DOWN THE PROBLEM, IT STILL APPEARS
// const sub = Meteor.subscribe(name, ...args, {
// onStop: error => {
// if (onError) {
// DEBUG(`AsyncValue subscription error, sending to onError:`, error);
// onError(error, setError);
// } else {
// if (error) console.error('AsyncValue Subscription error:', error);
// setError(error);
// }
// },
// });
// DEBUG(`sub: ready=${sub.ready()}, entries:`, query);
// return sub.ready() ? query() : undefined;
return undefined;
}
[]
);
DEBUG(`sub value:`, value);
const renderValue = () => (render ? render(value) : value);
return <>{value !== undefined ? renderValue() : placeholder()}</>;
}
Works fine if contact is set from the start - but whenever contact changes from being null to non-null, this error occurs:
Uncaught Error: Can't set timers inside simulations
at withoutInvocation (meteor.js?hash=3fe70c93a2fcd225dc5cc6572b8c3e39756a507b:621:13)
at bindAndCatch (meteor.js?hash=3fe70c93a2fcd225dc5cc6572b8c3e39756a507b:633:33)
at Meteor.defer (meteor.js?hash=3fe70c93a2fcd225dc5cc6572b8c3e39756a507b:694:24)
at useTracker.ts:163:12
at mountMemo (modules.js?hash=bfdeb58d2ee948751f18b6466ad43663c2847a1e:133794:19)
at Object.useMemo (modules.js?hash=bfdeb58d2ee948751f18b6466ad43663c2847a1e:134090:16)
at useMemo (modules.js?hash=bfdeb58d2ee948751f18b6466ad43663c2847a1e:113407:21)
at useTrackerWithDeps (useTracker.ts:137:3)
at useTrackerClient (useTracker.ts:206:12)
at useTrackerDev (useTracker.ts:244:16)
Also tried useTracker with subscription as dep (same error as above) and without deps - which causes this error:
Uncaught Error: Can't set timers inside simulations
at withoutInvocation (meteor.js?hash=3fe70c93a2fcd225dc5cc6572b8c3e39756a507b:621:13)
at bindAndCatch (meteor.js?hash=3fe70c93a2fcd225dc5cc6572b8c3e39756a507b:633:33)
at Meteor.defer (meteor.js?hash=3fe70c93a2fcd225dc5cc6572b8c3e39756a507b:694:24)
at useTrackerNoDeps (useTracker.ts:81:12)
at useTrackerClient (useTracker.ts:204:12)
at useTrackerDev (useTracker.ts:244:16)
- Dominant language
- JavaScript
- Stars
- 576
- Forks
- 167
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from meteor/react-packages
-
useTracker renders two times at mount, would be nice if it renders only oncePossibly taken @Poyoman39 claimed this 547 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 30/100
meteor/react-packages#439 · 6 comments · 1 reaction ·
-
Concurrency issue with useFindPossibly taken @Poyoman39 claimed this 547 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
meteor/react-packages#418 · 8 comments · 1 reaction ·
-
Suspense throws undefined errorMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
meteor/react-packages#413 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
meteor/react-packages#411 · 3 comments ·
-
Dependent executionOpendocumentation enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 28/100
meteor/react-packages#407 · 4 comments ·
All issues in meteor/react-packages
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
no-human-ai/no_human#659 ·
Maintainers usually reply within 1 day
-
[BUG] Multi-day events show "Ended" while still in progressPossibly taken @tarunagnihotri534 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
data-umbrella/du-event-board#231 · 2 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
IO.get_env on Node truncates names at embedded NULPossibly taken @Yi-111-a claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
HigherOrderCO/Bend#1449 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
cryptpad/documentation#162 ·