Skip to content

Commit 4d3bc0f

Browse files
authored
Merge pull request #32 from cs-open/fix/bg
Fix/bg
2 parents e942e17 + a96fafd commit 4d3bc0f

File tree

10 files changed

+35
-6
lines changed

10 files changed

+35
-6
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ function Toolbar() {
293293

294294
### 跨组件状态访问
295295

296+
ReactFabricProvider 是一个上下文提供程序,允许您从组件树中的任何位置访问流的内部状态,例如子组件,甚至在 ReactFabric 之外 元件。它通常用于应用程序的顶层。
297+
在这种情况下,您可能需要使用 ReactFabricProvider 组件
298+
296299
```tsx
297300
import { ReactFabricProvider, useReactFabric } from '@cs-open/react-fabric'
298301

packages/react/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @cs-open/react-fabric
22

3+
## 0.0.14
4+
5+
### Patch Changes
6+
7+
- sas
8+
39
## 0.0.13
410

511
### Patch Changes

packages/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@cs-open/react-fabric",
33
"type": "module",
4-
"version": "0.0.13",
4+
"version": "0.0.14",
55
"description": "React Fabric",
66
"keywords": [
77
"@cs-open/react-fabric",

packages/react/src/components/BackgroundImage/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const BackgroundImage = forwardRef<Handle, BackgroundImageProps>(
3939
const backgroundImageRef = useRef<FabricImage | null>(null)
4040

4141
const store = useStoreApi()
42+
const newestSrcRef = useRef(src)
4243

4344
const { width, height } = useStore(selector)
4445

@@ -132,13 +133,14 @@ const BackgroundImage = forwardRef<Handle, BackgroundImageProps>(
132133
}
133134
const { domNode, setLoading } = store.getState()
134135
setLoading(true)
136+
newestSrcRef.current = src
137+
135138
FabricImage.fromURL(src, { crossOrigin: 'anonymous' })
136139
.then(imageSource => {
137140
onLoad?.(imageSource)
138141
const currentSrc = imageSource.getSrc()
139-
const latestSrc = backgroundImageRef.current?.getSrc()
140142

141-
if (latestSrc && currentSrc !== latestSrc) {
143+
if (currentSrc !== newestSrcRef.current) {
142144
return
143145
}
144146

tooling/eslint-config/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @cs-open/eslint-config
22

3+
## 0.0.11
4+
5+
### Patch Changes
6+
7+
- sas
8+
39
## 0.0.10
410

511
### Patch Changes

tooling/eslint-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cs-open/eslint-config",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"private": true,
55
"license": "MIT",
66
"exports": {

tooling/rollup-config/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @cs-open/rollup-config
22

3+
## 0.0.11
4+
5+
### Patch Changes
6+
7+
- sas
8+
39
## 0.0.10
410

511
### Patch Changes

tooling/rollup-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cs-open/rollup-config",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"private": true,
55
"license": "MIT",
66
"type": "module",

tooling/tsconfig/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @cs-open/tsconfig
22

3+
## 0.0.11
4+
5+
### Patch Changes
6+
7+
- sas
8+
39
## 0.0.10
410

511
### Patch Changes

tooling/tsconfig/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cs-open/tsconfig",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"private": true,
55
"license": "MIT"
66
}

0 commit comments

Comments
 (0)