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

fix error with hot module replacement #264

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e969116
fix error with hot module replacement
PatrykWalach Nov 12, 2024
25ba84c
update tests
PatrykWalach Nov 12, 2024
7d4628d
fix cleanup
PatrykWalach Nov 14, 2024
1ddc73b
don't use stale itemCleanupPairRef
PatrykWalach Nov 14, 2024
07de136
Rename TextSource -> RelativeTextSource and SourceFileName to Relativ…
rbalicki2 Jan 3, 2025
760b2c1
rename more structs to include Embedded in their name
rbalicki2 Jan 3, 2025
1169c86
Add AbsoluteEmbeddedLocation wrapper.
rbalicki2 Jan 3, 2025
bdd06db
add comment for guards added in `useEffects`
PatrykWalach Jan 3, 2025
e1a897d
fix error with hot module replacement
PatrykWalach Nov 12, 2024
ad1282a
update tests
PatrykWalach Nov 12, 2024
5bc585f
fix cleanup
PatrykWalach Nov 14, 2024
ef89d4d
don't use stale itemCleanupPairRef
PatrykWalach Nov 14, 2024
c8d6a76
add comment for guards added in `useEffects`
PatrykWalach Jan 3, 2025
f8e6e1b
Merge branch 'bandaid-error-on-hot-module-replacement' of github.com:…
PatrykWalach Jan 3, 2025
b18976d
run cargo fmt
rbalicki2 Jan 3, 2025
db10124
AbsoluteEmbeddedLocation doesnt need to implement Copy
rbalicki2 Jan 4, 2025
8a2ecd0
Create AbsoluteLocation struct
rbalicki2 Jan 4, 2025
b9ec7bd
std::fmt::Display the directive name directly, not the WithEmbededRel…
rbalicki2 Jan 4, 2025
0a63b51
remove unneeded impls
rbalicki2 Jan 4, 2025
7970dd3
Merge branch 'main' into bandaid-error-on-hot-module-replacement
PatrykWalach Jan 4, 2025
fbd0172
Merge branch 'main' into bandaid-error-on-hot-module-replacement
PatrykWalach Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/isograph-react-disposable-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"devDependencies": {
"@types/react": "18.3.1",
"@types/react-test-renderer": "^18.3.0",
"react-test-renderer": "^18.2.0",
"typescript": "5.6.3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, test, vi, expect, assert } from 'vitest';
import { ParentCache } from './ParentCache';
import { ItemCleanupPair } from '@isograph/disposable-types';
import { useCachedResponsivePrecommitValue } from './useCachedResponsivePrecommitValue';
import React from 'react';
import React, { StrictMode, type ReactElement } from 'react';
import { create } from 'react-test-renderer';
import { CacheItem, CacheItemState } from './CacheItem';

Expand Down Expand Up @@ -51,9 +51,10 @@ function promiseAndResolver() {

// The fact that sometimes we need to render in concurrent mode and sometimes
// not is a bit worrisome.
async function awaitableCreate(Component, isConcurrent) {
async function awaitableCreate(Component: ReactElement, isConcurrent) {
const element = create(
Component,
<StrictMode>{Component}</StrictMode>,
// @ts-expect-error
isConcurrent ? { unstable_isConcurrent: true } : undefined,
);
await shortPromise();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export function useCachedResponsivePrecommitValue<T>(
const lastCommittedParentCache = useRef<ParentCache<T> | null>(null);

useEffect(() => {
if (lastCommittedParentCache.current === parentCache) {
rbalicki2 marked this conversation as resolved.
Show resolved Hide resolved
return;
}

lastCommittedParentCache.current = parentCache;
// On commit, cacheItem may be disposed, because during the render phase,
// we only temporarily retained the item, and the temporary retain could have
Expand Down
16 changes: 13 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading