MCPcopy
hub / github.com/mobxjs/mobx / observerSCU

Function observerSCU

packages/mobx-react/src/observerClass.ts:237–252  ·  view source on GitHub ↗
(nextProps: ClassAttributes<any>, nextState: any)

Source from the content-addressed store, hash-verified

235}
236
237function observerSCU(nextProps: ClassAttributes<any>, nextState: any): boolean {
238 if (isUsingStaticRendering()) {
239 console.warn(
240 "[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."
241 )
242 }
243 // update on any state changes (as is the default)
244 if (this.state !== nextState) {
245 return true
246 }
247 // update if props are shallowly not equal, inspired by PureRenderMixin
248 // we could return just 'false' here, and avoid the `skipRender` checks etc
249 // however, it is nicer if lifecycle events are triggered like usually,
250 // so we return true here if props are shallowly modified.
251 return !shallowEqual(this.props, nextProps)
252}
253
254function createObservablePropDescriptor(key: "props" | "state" | "context") {
255 return {

Callers

nothing calls this directly

Calls 2

isUsingStaticRenderingFunction · 0.90
shallowEqualFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…