Skip to content

Commit

Permalink
fix(homebrew oracles): Fixed new homebrew oracles not showing up on m…
Browse files Browse the repository at this point in the history
…obile
  • Loading branch information
scottbenton committed Apr 11, 2024
1 parent dc7c776 commit cf7515c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function MoveDrawerUnMemoized(props: MoveDrawerProps) {
const { open, onClose } = props;

const useNewMoves = useNewCustomContentPage();

const openCallback = useCallback(() => {}, []);
return (
<SwipeableDrawer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { SwipeableDrawer } from "@mui/material";
import { OracleSection } from "./OracleSection";
import { OracleSection as OracleSectionOld } from "./OracleSection";
import { OracleSection } from "./NewOracleSection";
import React, { useCallback } from "react";
import { useNewCustomContentPage } from "hooks/featureFlags/useNewCustomContentPage";

export interface OracleDrawerProps {
open?: boolean;
Expand All @@ -10,6 +12,7 @@ export interface OracleDrawerProps {
function OracleDrawerUnMemoized(props: OracleDrawerProps) {
const { open, onClose } = props;

const showNewOracles = useNewCustomContentPage();
const openCallback = useCallback(() => {}, []);
return (
<SwipeableDrawer
Expand All @@ -20,7 +23,7 @@ function OracleDrawerUnMemoized(props: OracleDrawerProps) {
disableDiscovery
onClose={onClose}
>
<OracleSection />
{showNewOracles ? <OracleSection /> : <OracleSectionOld />}
</SwipeableDrawer>
);
}
Expand Down
13 changes: 13 additions & 0 deletions src/stores/homebrew/homebrew.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ export const createHomebrewSlice: CreateSliceType<HomebrewSlice> = (
subscribeToHomebrewContent: (homebrewIds) => {
getState().rules.setExpansionIds(homebrewIds);

const defaultHomebrewIds = homebrewIds.filter(
(homebrewId) => defaultExpansions[homebrewId]
);

if (defaultHomebrewIds.length > 0) {
getState().rules.rebuildOracles();
getState().rules.rebuildMoves();
getState().rules.rebuildStats();
getState().rules.rebuildConditionMeters();
getState().rules.rebuildSpecialTracks();
getState().rules.rebuildImpacts();
}

const filteredHomebrewIds = homebrewIds.filter(
(homebrewId) => !defaultExpansions[homebrewId]
);
Expand Down

0 comments on commit cf7515c

Please sign in to comment.