fix: show new rule once created
This commit is contained in:
parent
5a94d6f6e9
commit
bf6ee2f71d
2 changed files with 8 additions and 2 deletions
|
|
@ -414,6 +414,7 @@ export class Core {
|
|||
msg.data.blockType,
|
||||
msg.data.baseFilename,
|
||||
);
|
||||
walkDirCache.invalidate();
|
||||
await this.configHandler.reloadConfig(
|
||||
"Local block created (config/addLocalWorkspaceBlock message)",
|
||||
);
|
||||
|
|
@ -422,6 +423,7 @@ export class Core {
|
|||
on("config/addGlobalRule", async (msg) => {
|
||||
try {
|
||||
await createNewGlobalRuleFile(this.ide, msg.data?.baseFilename);
|
||||
walkDirCache.invalidate();
|
||||
await this.configHandler.reloadConfig(
|
||||
"Global rule created (config/addGlobalRule message)",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -132,8 +132,6 @@ interface RuleCardProps {
|
|||
|
||||
const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
||||
const dispatch = useAppDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const mode = useAppSelector((store) => store.session.mode);
|
||||
const policy = useAppSelector((state) =>
|
||||
rule.name
|
||||
? state.ui.ruleSettings[rule.name] || DEFAULT_RULE_SETTING
|
||||
|
|
@ -397,6 +395,7 @@ function RulesSubSection() {
|
|||
const dispatch = useAppDispatch();
|
||||
const isLocal = selectedProfile?.profileType === "local";
|
||||
const [globalRulesMode, setGlobalRulesMode] = useState<string>("workspace");
|
||||
const configLoading = useAppSelector((store) => store.config.loading);
|
||||
|
||||
const handleAddRule = (mode?: string) => {
|
||||
const currentMode = mode || globalRulesMode;
|
||||
|
|
@ -487,6 +486,11 @@ function RulesSubSection() {
|
|||
{sortedRules.map((rule, index) => (
|
||||
<RuleCard key={index} rule={rule} />
|
||||
))}
|
||||
{configLoading && (
|
||||
<div className="px-2 py-1.5 text-xs opacity-65">
|
||||
Reloading rules from your config...
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<EmptyState message="No rules configured. Click the + button to add your first rule." />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue