mirror of
https://github.com/re-rxjs/react-rxjs.git
synced 2025-12-08 18:01:51 +00:00
fix Subscribe running in react18 StrictMode (#249)
This commit is contained in:
parent
fb7004a066
commit
da4c7c6c30
@ -1,7 +1,15 @@
|
||||
import { render } from "@testing-library/react"
|
||||
import React, { useState } from "react"
|
||||
import React, { StrictMode, useState } from "react"
|
||||
import { defer, Observable, of } from "rxjs"
|
||||
import { bind, Subscribe } from "./"
|
||||
import { bind, Subscribe as OriginalSubscribe } from "./"
|
||||
|
||||
const Subscribe = (props: any) => {
|
||||
return (
|
||||
<StrictMode>
|
||||
<OriginalSubscribe {...props} />
|
||||
</StrictMode>
|
||||
)
|
||||
}
|
||||
|
||||
describe("Subscribe", () => {
|
||||
describe("Subscribe with source$", () => {
|
||||
|
||||
@ -77,6 +77,7 @@ export const Subscribe: React.FC<{
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
subscriptionRef.current!.unsubscribe()
|
||||
subscriptionRef.current = undefined
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user