Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWangJustToDo committed Nov 27, 2024
1 parent 8894f80 commit b716a7b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions app/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export default defineConfig({
socialLinks: [{ icon: "github", link: "https://github.com/MrWangJustToDo/r-store" }],
},
head: [
["link", { rel: "preconnect", href: "https://fonts.cdnfonts.com/", crossorigin: "" }],
["link", { rel: "stylesheet", href: "https://fonts.cdnfonts.com/css/google-sans" }],
["link", { rel: "preconnect", href: "https://fonts.googleapis.com" }],
["link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: "" }],
["link", { rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Outfit:[email protected]&display=swap" }],
["link", { rel: "icon", href: "/reactivity-store/favicon.png" }],
],
});
2 changes: 1 addition & 1 deletion app/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/* font-family */
:root {
--vp-font-family-base: Product Sans, sans-serif, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif,
--vp-font-family-base: Outfit, sans-serif, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif,
Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/r-store/src/hook/useReactiveEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createLifeCycle } from "../shared/lifeCycle";

const temp = new Set<Controller>();

const defaultCompare = () => true;
const defaultCompare = () => false;

/**
* @public
Expand Down
8 changes: 4 additions & 4 deletions packages/r-store/src/shared/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ export class Controller<T = any> {
};

_scheduler = () => {
const newState = this.run();
const newState = this._effect.run();

if (!this._isActive) return;

const needTrigger = this._compare(this._state, newState);
const isSame = this._compare(this._state, newState);

this._state = newState;

if (needTrigger) {
if (!isSame) {
if (this._lifeCycle.canUpdateComponent) {
if (this._lifeCycle.syncUpdateComponent) {
this.notify();
Expand Down Expand Up @@ -181,7 +181,7 @@ export class Controller<T = any> {

// TODO move into constructor function?
run() {
return this._effect.run();
this._state = this._effect.run();
}

stop() {
Expand Down
2 changes: 1 addition & 1 deletion packages/r-store/src/shared/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const namespaceMap: Record<string, unknown> = {};

const temp = new Set<Controller>();

const defaultCompare = () => true;
const defaultCompare = () => false;

/**
* @internal
Expand Down
2 changes: 1 addition & 1 deletion packages/r-store/src/shared/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const createHook = <T extends Record<string, unknown>, C extends Record<s
if (compare && typeof compare === "function") {
return compare(p, n);
}
return true;
return false;
});

// may not work will with hmr
Expand Down
2 changes: 1 addition & 1 deletion packages/r-store/src/state/middleware/withPersist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { StorageState } from "../tools";

const temp = new Set<Controller>();

const defaultCompare = () => true;
const defaultCompare = () => false;

/**
* @public
Expand Down

0 comments on commit b716a7b

Please sign in to comment.